I spent a couple hours the other day at work tracking why the "Math" object was completely gone in Internet Explorer. The reason for that is that someone defined a function as object property and labeled it "Math". Even though "Math" wasn't assigned, IE considered it global and wiped out the built-in "Math" object.
var myObject = {
myFunc: function Math() {
var a = 1;
}
}
alert(Math.round(1.2));
Internet Explorer here will manage to lose reference to the Math object. You can find a list of words to avoid at this URL: http://www.javascripter.net/faq/reserved.htm. I'd be curious to see, according to ECMA standards who is right, IE or the half-dozen other browsers out there. Anyways... if you lose a built-in class one day, don't just hunt at the top level, it could be a sneaky function declared but unassigned.
Last Update: 2009-11-16 · Bertrand Janin <tamentis@neopulsar.org> · Powered by Python & Debian GNU/Linux