Evolution and Geneone have been plagued by some Javascript errors in Internet Explorer over the last few weeks. To be honest, the number of people who play Evolution or visit my blog using IE are so low that no one has actually bothered complaining.
These errors included Object expected and "Expected identifier, string or number". I’ve never tried to actually fix these errors before because IE’s script debugging really really sucks.
Windows Scripting Debugger can be a useful tool for debugging Javascript but be warned that it is very very unstable and severely affects the stability of your computer.
Expected identifier, string or number
This was an annoying little bug caused in a class because of a comma at the end. In Javascript you have lists like:
var list = { opacity: 0.5, height: 0.5}
Similar syntax is used to group functions:
var MyFuncs = {
bleh : function() {},
bleh2 : function() {},
}
The above code should work fine in real web browsers such as Firefox. IE will give a screwed up error such as "Expected identifier, string or number". Just remove the comma after the last function and the error be gone.
Object Expected
If you document.getElementsById(‘nonexistantitem’) in Firefox and try to retrieve an attribute such as previousSibling, Firefox won’t complain. IE will. This was causing issues as I had a little bit of Javascript which searched for the "Entry Title" box above the "Message" box in the Object Creation forms. On pages where the Entry Title field weren’t shown, IE would freak out as the previousSibling would return False.
I should thank neonDragon for his assistance in resolving these issues