The following code work in FF but not IE8:
var j = "test";
alert(j instanceof HTMLElement);
I don't think IE uses the HTMLElement object. Is there a safe way to do this check in IE? Perhaps there is a YUI solution?
The following code work in FF but not IE8:
var j = "test";
alert(j instanceof HTMLElement);
I don't think IE uses the HTMLElement object. Is there a safe way to do this check in IE? Perhaps there is a YUI solution?
I use to check the nodeType property, it should be 1 for all HTML element objects.
I used it in my crossbrowser library before I switched to jQuery.
text has a nodeType of 3 and any custom objects probably won't have a nodeType property at all.
If you look at the jQuery source code (not the minified one ffs!), you'll see they make use of nodeType
a lot.