IE7 + Prototype + comma = “‘undefined’ is null or not an object”
So again an infuriating bug, all down to this thing: , <–
So whenever you’re iterating (Enumerable.each() in this case) check that you haven’t got a superfluous comma in the object that you’re iterating through.
Normally this gets caught as a syntax error, but, because this code was being AJAXed, this didn’t happen and an obscure runtime error occured, buried deep within Prototype (inside 10 levels of anonymous functions)
Firefox it seems is much more lenient than IE in this case as it didn’t throw any error at all, simply ignoring the comma. Again the age old debate about fixing broken code rises. I think IE got it more right in this case. Markup (HTML) is a different issue - that should be corrected (though use XHTML whenever possible), but when it comes to code you need the extra safety. In a perfect world code thats AJAXed would also throw syntax errors.