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:
- The
Nodetype doesn’t exist, so you still can’t accessNode.ELEMENT_NODEas you can in other browsers. - The
Elementtype exists, but sinceNodedoesn’t, it’s not a subtype. - The
HTMLElementtype doesn’t exist even though, technically,HTMLElementis the base type for all of the other HTML element types. For example,HTMLBodyElementinherits fromHTMLElementwhich inherits fromElement. - Getters and setters are supported via
__defineGetter__()and__defineSetter__(). Sadly, these are only available on the DOM types and not on native JScript objects. - Other available types:
NodeList,NamedNodeMap,Attr,Text,DOMImplementation,HTMLDocument,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 onNodeListorHTMLCollectionobjects.
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.