Every time I think I know something, JavaScript humbles me. Darn.
I'm doing an application, being very careful to have exactly one
global variable: my namespace object. Then I discover this:
var foo = document.createElement( 'whatever' );
foo.id = 'x'
alert( typeof(x) ); // undefined
document.body.appendChild( foo )
alert( typeof(x) ); // object
alert( x === document.getElementById( 'x' ) ); true
So my namespace is joined by a global variable for every DOM element
that has an id. Ugh. What to do?
(Behavior checked in Chrome, Firefox, MSIE8, Opera and Safari Win.)
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]