Within javascript's scope, referring to HTMLDocument
or HTMLElement
raises error on IE8.
The error I get is "HTMLElement is undefined".
What is the way to have JS interacting with native DOM object of this browser?
In IE8 you have to use the Element
and HTMLDocument
classes. In IE7... nothing, because IE7 is terrible for standards. You have to rely on jQuery or other frameworks that wrap DOM elements.
In my own framework I make this simple check:
var elementPrototype = typeof HTMLElement !== "undefined"
? HTMLElement.prototype : Element.prototype;
Mind you that it's not a framework for IE7 and lower.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With