This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The html and dom specs only have Document and XMLDocument. This does not match reality where we actually have HTMLDocument as well. WebKit/Blink: XMLDocument === Document // true HTMLDocument.prototype.__proto__ === Document.prototype // true SVGDocument.prototype.__proto__ === Document.prototype // true document.implementation.createDocument(null, 'root', null) // Document document.implementation.createDocument('http://www.w3.org/1999/xhtml/', 'html', null) // Document document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null) // SVGDocument document.implementation.createHTMLDocument('title') // HTMLDocument Gecko: XMLDocument.prototype.__proto__ === Document.prototype // true HTMLDocument.prototype.__proto__ === Document.prototype // true SVGDocument.prototype.__proto__ === Document.prototype // true document.implementation.createDocument(null, 'root', null) // XMLDocument document.implementation.createDocument('http://www.w3.org/1999/xhtml/', 'html', null) // XMLDocument document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null) // XMLDocument document.implementation.createHTMLDocument('title') // HTMLDocument IE10: typeof XMLDocument // 'undefined' typeof HTMLDocument // 'undefined' typeof SVGDocument // 'undefined' document.implementation.createDocument(null, 'root', null) // Document document.implementation.createDocument('http://www.w3.org/1999/xhtml/', 'html', null) // Document document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null) // Document document.implementation.createHTMLDocument('title') // Document IE11: XMLDocument.prototype.__proto__ === Document.prototype // true HTMLDocument.prototype.__proto__ === Document.prototype // true typeof SVGDocument // 'undefined' document.implementation.createDocument(null, 'root', null) // XMLDocument document.implementation.createDocument('http://www.w3.org/1999/xhtml/', 'html', null) // XMLDocument document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null) // XMLDocument document.implementation.createHTMLDocument('title') // HTMLDocument It is unclear if there is a way to create an SVGDocument in IE and Gecko.
The solution here is for the browsers to align with the specs. It doesn't make sense to have separate SVGDocument and HTMLDocument objects. You can have HTML in SVG and SVG in HTML.
(In reply to comment #1) > The solution here is for the browsers to align with the specs. Virtually all browser vendors disagree with merging: https://bugzilla.mozilla.org/show_bug.cgi?id=897815 https://code.google.com/p/chromium/issues/detail?id=238368 https://bugs.webkit.org/show_bug.cgi?id=110772 In particular, IE11 reversed the behavior. > It doesn't make sense to have separate SVGDocument and HTMLDocument objects. > You can have HTML in SVG and SVG in HTML. Unfortunately, it's common that browsers are doing something totally nonsensical and the spec will have to document the nonsense.
> Virtually all browser vendors disagree with merging: > https://bugzilla.mozilla.org/show_bug.cgi?id=897815 > https://code.google.com/p/chromium/issues/detail?id=238368 > https://bugs.webkit.org/show_bug.cgi?id=110772 Those bugs are still open. I wouldn't characterise that as disagreeing, just being cautious, as they should with something this drastic. This is the same thing we went through (correctly and appropriately) with the HTML parser. > > It doesn't make sense to have separate SVGDocument and HTMLDocument objects. > > You can have HTML in SVG and SVG in HTML. > > Unfortunately, it's common that browsers are doing something totally > nonsensical and the spec will have to document the nonsense. Sure, but that's not the only choice. Here in particular it doesn't seem to be the right choice, even. There's maybe work to do — for see this thread: http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Oct/0062.html But just sticking with the old solution of separate SVGDocumetn and HTMLDocument objects just doesn't work.
*** Bug 25028 has been marked as a duplicate of this bug. ***
(In reply to Ian 'Hixie' Hickson from comment #3) > > Virtually all browser vendors disagree with merging: > > https://bugzilla.mozilla.org/show_bug.cgi?id=897815 > > https://code.google.com/p/chromium/issues/detail?id=238368 > > https://bugs.webkit.org/show_bug.cgi?id=110772 > > Those bugs are still open. I wouldn't characterise that as disagreeing, just > being cautious, as they should with something this drastic. This is the same > thing we went through (correctly and appropriately) with the HTML parser. FYI, Blink has already merged SVGDocument into Document: http://src.chromium.org/viewvc/blink?view=revision&revision=166179 We also started moving attributes from HTMLDocument to Document (even though HTMLDocument still exists for now): https://code.google.com/p/chromium/issues/detail?id=362955 http://src.chromium.org/viewvc/blink?view=rev&rev=165515
*** Bug 27684 has been marked as a duplicate of this bug. ***
https://github.com/whatwg/dom/issues/221 https://github.com/whatwg/dom/issues/278 It seems engines are slowly merging these. At the end of that process we might have to do some additional cleanup, but that'll be filed as follow up issues.