Quote:
Originally Posted by Old Pedant
I think you should *HAVE* to write
Code:
if ( document.getElementsByClassName === null ) { ... }
|
There is an error in your logic there. The mention of document.getElementsByClassName would presumably create it if it doesn't exist. As it now exists without having had a value allocated it now has a value of undefined and not null. When using === undefined !== null.
The correct way to write it is:
Code:
if (typeof document.getElementsByClassName === undefined ) { ... }