This is the state of Document, HTMLDocument, SVGDocument and XMLDocument interfaces on the web platform as of September 2016. Main spec issues:
See the timeline for history and tests for current behavior.
These are the options in terms of which document interfaces are concrete:
Document becomes an abstract interface like Node or CharacterData. The Document constructor is removed.
Changes:
- Chromium: None/trivial.
- Edge: Make existing
DocumentinstancesXMLDocumentinstead. - Gecko: Remove the
Documentconstructor. Make existingSVGDocumentinstancesXMLDocumentinstead. - WebKit: Remove the
Documentconstructor.
Like above, but the Document constructor remains, and is the only way to create a Document instance. When both Document and XMLDocument are concrete and represent the same thing, this is the least inconsistent state possible. It would be an odd API to avoid.
Changes:
- Chromium: Implement the
Documentconstructor. - Edge: Implement the
Documentconstructor. Make existingDocumentinstancesXMLDocumentinstead. - Gecko: Make existing
SVGDocumentinstancesXMLDocumentinstead. - WebKit: None/trivial.
XMLDocument is made an alias of Document.
Changes:
- Chromium: Make
XMLDocumentan alias ofDocumentagain. - Edge: Make
XMLDocumentan alias ofDocument. - Gecko: Make
XMLDocumentan alias ofDocument, droppingasyncandload(). Make existingSVGDocumentinstancesDocumentinstead. - WebKit: Make
XMLDocumentan alias ofDocumentagain.
Like above, but also attempt making HTMLDocument an alias of Document.
Maybe.
The risk of making HTMLDocument an alias of Document is for documents that are currently not instanceof HTMLDocument. The string "instanceof HTMLDocument" is common in HTTP Archive, and it would require in-depth analysis to judge the risk.
Maybe.
Gecko has async and load() on XMLDocument. They were originally on Document, which broke stuff. A usecounter in Gecko could help.
For WebKit-identifying engines it is likely still Web compatible to make XMLDocument an alias of Document, as that was done from 2006 to 2016 in WebKit and up to 2014 in Chromium.
A problem with virginamerica.com resulted in a lot of changes in 2011. The problem was in the Sarissa library, in GlobalScriptFile_08232011.js (pretty-printed) on virginamerica.com.
The spec bug was resolved by adding [LenientThis] to onreadystatechange, so that XMLDocument.prototype.onreadystatechange = null silently does nothing.
Note that Sarissa merely replaced XMLDocument.prototype.load and internally used the original method. All non-IE browsers get this code path, so it's only if load() is called by some other code that it would break, which is the case without Sarissa as well.
Maybe. Gecko and WebKit engineers are skeptical about removing it.
This probably does not matter for compat, because Edge has everything on Document and the other engines still have a variety of things on HTMLDocument. "As long as we have interop, it doesn't really matter where the properties are, so take the path of least resistance."
IE6 (tested) and possibly earlier (not tested) could create documents using MSXML which supported async and load().
- DOM Level 3 Content Models and Load and Save:
document.loadand friends first appear. - Gecko: Simple Javascript doesn't work
- Removing the method load() from HTML documents, implement it only on XML documents since the name 'load' blocks existing global functions named 'load' from being called from event handlers in the document (since document.load is found before window.load in the scope of event handlers). HTMLDocument.load and XULDocument.load were never implemented any way.
- DOM Level 3 Load and Save:
document.loadand friends becomeDOMParser.
- WebKit: Add constructors for DocumentFragment, HTMLElement, HTMLDocument and XMLDocument. XMLDocument is just
an alias for the Document constructor (Note: the
HTMLElementandHTMLDocumentconstructors are now gone) - WebKit: Implement XMLDocument.load (never happened)
- Gecko: Deprecate DOM3 Load (XMLDocument.load) ("Use of document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest")
- Gecko: Virgin America website won't load correctly : Illegal operation on WrappedNative prototype object due to setting XMLDocument.prototype.onreadystatechange
- Allow the onreadystatechange getter/setter on Document.prototype to not throw even if its |this| is bogus
- HTML: Should XMLDocument be standardized?
- Make HTMLDocument === Document + fix + tweak
- Make document.prototype.onreadystatechange not throw, for compat reasons
- Move XMLDocumentLoader.load to XMLDocument.
- SVG: SVGDocument interface (alias to Document?) ("this is the direction HTML is going")
- Make SVGDocument into an alias for document
- Firefox 20 is released with a
Documentconstructor. - IE11 is released with separate
HTMLDocumentandXMLDocumentinterfaces, both empty. Earlier versions of IE had only aDocumentinterface, but could create different kinds of documents using MSXML, see beginning of timeline.
- Chromium: Implement XMLDocument interface
- XMLHttpRequest.responseXML objects and DOMParser.parseFromString objects does not inherit from the same class since Chrome 34 Beta
- WebKit: Document should be constructable
- Gecko: Document() constructor should return Document object (not XMLDocument)
- SVG: window.SVGDocument alias is probably not needed for web compat
- Remove requirement for SVGDocument property on the Document interface object
- WebKit: An XMLDocument interface should be exposed on the global Window object
- DOM: Un-merge Document and HTMLDocument
- HTML: Remove XMLDocument.prototype.load
- DOM: Figure out what to do with XMLDocument
- HTML: Add back XMLDocument.prototype.load in Gecko compatibility mode
- DOM: Clarify that new Document creates a document of type "html", not "xml"
- WebKit: Drop SVGDocument as per the SVG2 specification (Note: leaves
SVGDocumentalias) - Gecko: Remove SVGDocument
Note: XSLT was not tested.
| API | Interface |
|---|---|
| createDocument | XMLDocument |
| createDocument (xhtml) | XMLDocument |
| createDocument (svg) | XMLDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | XMLDocument |
| iframe (svg) | XMLDocument |
| iframe (xml) | XMLDocument |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | XMLDocument |
| XHR (svg) | XMLDocument |
| XHR (xml) | XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | XMLDocument |
| DOMParser (svg) | XMLDocument |
| DOMParser (xml) | XMLDocument |
| DOMParser (invalid xml) | XMLDocument |
| Interface | Prototype |
|---|---|
| HTMLDocument | alinkColor, all, bgColor, captureEvents, clear, constructor, fgColor, linkColor, releaseEvents, vlinkColor |
| XMLDocument | constructor |
| API | Interface |
|---|---|
| createDocument | XMLDocument |
| createDocument (xhtml) | XMLDocument |
| createDocument (svg) | XMLDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | Document |
| iframe (svg) | Document |
| iframe (xml) | Document |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | XMLDocument |
| XHR (svg) | XMLDocument |
| XHR (xml) | XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | XMLDocument |
| DOMParser (svg) | XMLDocument |
| DOMParser (xml) | XMLDocument |
| DOMParser (invalid xml) | Document |
| Interface | Prototype |
|---|---|
| HTMLDocument | constructor |
| XMLDocument | constructor |
| API | Interface |
|---|---|
| createDocument | XMLDocument |
| createDocument (xhtml) | HTMLDocument |
| createDocument (svg) | SVGDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | HTMLDocument |
| iframe (svg) | SVGDocument |
| iframe (xml) | XMLDocument |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | XMLDocument |
| XHR (svg) | XMLDocument |
| XHR (xml) | XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | XMLDocument |
| DOMParser (svg) | SVGDocument |
| DOMParser (xml) | XMLDocument |
| DOMParser (invalid xml) | XMLDocument |
| Interface | Prototype |
|---|---|
| HTMLDocument | alinkColor, all, anchors, applets, bgColor, body, captureEvents, clear, close, constructor, cookie, designMode, domain, embeds, execCommand, fgColor, forms, getElementsByName, getItems, getSelection, head, images, linkColor, links, open, plugins, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue, releaseEvents, scripts, vlinkColor, write, writeln |
| SVGDocument | constructor, domain, rootElement |
| XMLDocument | async, constructor, load |
| API | Interface |
|---|---|
| createDocument | XMLDocument |
| createDocument (xhtml) | XMLDocument |
| createDocument (svg) | SVGDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | XMLDocument |
| iframe (svg) | SVGDocument |
| iframe (xml) | XMLDocument |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | XMLDocument |
| XHR (svg) | XMLDocument |
| XHR (xml) | XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | XMLDocument |
| DOMParser (svg) | SVGDocument |
| DOMParser (xml) | XMLDocument |
| DOMParser (invalid xml) | XMLDocument |
| Interface | Prototype |
|---|---|
| HTMLDocument | alinkColor, all, bgColor, captureEvents, clear, close, compatMode, constructor, designMode, dir, embeds, fgColor, linkColor, open, plugins, releaseEvents, scripts, vlinkColor, write, writeln |
| SVGDocument | constructor, createEvent, rootElement |
| XMLDocument | constructor |
Note: SVGDocument was made an alias of Document in WebKit, so the results will change in a coming release.
In 2006, WebKit added XMLDocument as an alias of Document. Chromium and WebKit got real XMLDocument interfaces inheriting from Document in 2014 and 2016 respectively. Before those changes, Chrome and Safari had a shared behavior, which is likely still web compatible for at least WebKit-identifying engines:
| API | Interface |
|---|---|
| createDocument | Document |
| createDocument (xhtml) | Document |
| createDocument (svg) | SVGDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | Document |
| iframe (svg) | SVGDocument |
| iframe (xml) | Document |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | Document |
| XHR (svg) | Document |
| XHR (xml) | Document |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | Document |
| DOMParser (svg) | SVGDocument |
| DOMParser (xml) | Document |
| DOMParser (invalid xml) | Document |
| API | Interface |
|---|---|
| createDocument | Document or XMLDocument |
| createDocument (xhtml) | Document, HTMLDocument or XMLDocument |
| createDocument (svg) | SVGDocument or XMLDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | Document, HTMLDocument or XMLDocument |
| iframe (svg) | Document, SVGDocument or XMLDocument |
| iframe (xml) | Document or XMLDocument |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | Document or XMLDocument |
| XHR (svg) | Document or SVGDocument |
| XHR (xml) | Document or XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | Document or XMLDocument |
| DOMParser (svg) | SVGDocument or XMLDocument |
| DOMParser (xml) | Document or XMLDocument |
| DOMParser (invalid xml) | Document or XMLDocument |
| API | Interface |
|---|---|
| createDocument | XMLDocument |
| createDocument (xhtml) | HTMLDocument or XMLDocument |
| createDocument (svg) | SVGDocument or XMLDocument |
| createHTMLDocument | HTMLDocument |
| iframe (html) | HTMLDocument |
| iframe (xhtml) | Document, HTMLDocument or XMLDocument |
| iframe (svg) | Document, SVGDocument or XMLDocument |
| iframe (xml) | Document or XMLDocument |
| XHR (html) | HTMLDocument |
| XHR (xhtml) | Document or XMLDocument |
| XHR (svg) | Document or SVGDocument |
| XHR (xml) | Document or XMLDocument |
| DOMParser (html) | HTMLDocument |
| DOMParser (xhtml) | XMLDocument |
| DOMParser (svg) | SVGDocument or XMLDocument |
| DOMParser (xml) | XMLDocument |
| DOMParser (invalid xml) | Document or XMLDocument |
2005:
2007:
Document.asyncandDocument.loadhttp://www.opera.com/docs/changelogs/mac/801/
http://www.opera.com/docs/changelogs/windows/950b1/