Inside IE 8′s mutable DOM prototypes
When Internet Exporer 8 was released, a much talked-about feature was mutable DOM prototypes. I dug in this morning to figure out exactly what is and is not supported. As one would expect, the support is not as full as the nice writeup would have everyone believe. Here’s a quick summary:
Nodetype doesn’t exist, so you still can’t access
Node.ELEMENT_NODEas you can in other browsers.
Elementtype exists, but since
Nodedoesn’t, it’s not a subtype.
HTMLElementtype doesn’t exist even though, technically,
HTMLElementis the base type for all of the other HTML element types. For example,
HTMLElementwhich inherits from
- Getters and setters are supported via
__defineSetter__(). Sadly, these are only available on the DOM types and not on native JScript objects.
- Other available types:
HTMLCollection. Each of these supports getters and setters.
- Sadly, none of the DOM types are native JScript types, meaning the JScript engine sees all of the functions on the prototypes as objects and
Array.prototype.slice()still can’t be used on
I guess this is a good start from where IE was prior to this release, though still somewhat disappointing. Hopefully this feature will be more fleshed-out once they go GA.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.