Last Comment Bug 520969 - HTMLness of the createDocument() return value should be false regardless of doctype
: HTMLness of the createDocument() return value should be false regardless of d...
Status: NEW
: html5
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal with 2 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Andrew Overholt [:overholt]
Depends on: 897815
  Show dependency treegraph
Reported: 2009-10-07 04:13 PDT by Henri Sivonen (:hsivonen)
Modified: 2016-04-14 04:45 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Henri Sivonen (:hsivonen) 2009-10-07 04:13:09 PDT
The code at
is wrong per HTML5

HTML5 requires documents created with createDocument not to have the HTMLness bit set. Neither WebKit nor Opera sets the HTMLness bit from doctype.

(Also: HTML5 requires all document objects to implement HTMLDocument and SVGDocument.)
Comment 1 Olli Pettay [:smaug] 2009-10-07 06:10:08 PDT
Webkit creates XHTMLDocument only if namespace uri of the root element is XHTML.
That is pretty wrong.
Not sure what Opera does.
Comment 2 Olli Pettay [:smaug] 2009-10-07 06:12:40 PDT
And Gecko uses doctype for document creation, because that is what should be used
based on DOM 3 Core.

I don't know why HTML5 doesn't allow creating HTML documents, only XHTML documents.
Comment 3 Arkadiusz Michalski (Spirit) 2015-11-08 17:21:12 PST
Per actual DOM this method should always create XMLDocument object, without additional treatment for the doctype. Other browsers works like that (I test Chrome, IE11, Opera-Presto), and only Firefox is still inconsistent here (and for example, can output HTMLDocument or SVGDocument).

I catch only one case, when Opera-Presto return HTMLness, but other browser still don't do this:
	alert(document.implementation.createDocument("", "html", null));
Comment 4 Aryeh Gregor (:ayg) (next working March 28-April 26) 2016-04-14 04:26:13 PDT
I'm not sure if we want to do this without fixing bug 897815.  Making the document not HTML doesn't change much in spec-land, but for us it means you lose all the HTMLDocument-specific properties like .body.
Comment 5 Aryeh Gregor (:ayg) (next working March 28-April 26) 2016-04-14 04:45:17 PDT
Or, alternatively, if DOM issue 217 <> is resolved and we implement it, it should also be okay to fix this, because passing an HTML DTD but not the HTML namespace is silly and it probably doesn't matter what we do in that case.

An example of a wpt test that newly fails if we implement this as-is is dom/nodes/Node-isEqualNode.html, which tests that .createHTMLDocument() returns the same as a suitably adjusted .createDocument().
Comment 6 Aryeh Gregor (:ayg) (next working March 28-April 26) 2016-04-14 04:45:46 PDT
(Try run for reference:

Note You need to log in before you can comment on or make changes to this bug.