This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
DOMImplementation.createHTMLDocument(title)[1] describes like, 'Create a Text node, set its data to title (which could be the empty string), and append it to the title element created in the previous step.' While textContent attribute[2] says, 'If new value is not the empty string, set node to a new Text node whose data is new value.' So it is confusing how to handle empty title DOMString on implementation. [1] http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument [2] http://dom.spec.whatwg.org/#dom-node-textcontent test case: http://w3c-test.org/dom/nodes/DOMImplementation-createHTMLDocument.html test name: DOMImplementation.createHTMLDocument
For the information,(alphabetical order) chrome: fail ff: pass ie: fail
What is exactly confusing? textnode.data = ""; sets text node's content to "". element.textContent = ""; removes all the child nodes. element.textContent = "foo"; removes all the child nodes and creates a text node with data "foo" and appends it to element.
Basically, createHTMLDocument("foo") does NOT set .textContent = "foo" on the <title> element. It does something slightly different that guarantees there is a text node inside that <title>. Looking at Chrome's code, it implements createHTMLDocument("foo") by doing: document.title = "foo"; which is defined in the spec in terms of setting textContent on the <title> element, which in fact does not match what the DOM spec says to do for createHTMLDocument.
(In reply to Kangil Han from comment #1) > For the information,(alphabetical order) > chrome: fail > ff: pass > ie: fail Servo: pass
The specification does not seem confusing, but I guess comment 0 is actually asking if we want to align the two cases. I have no opinion really.
Thanks for comments! I am fixing chromium behavior as per comment 3 suggested by Boris. https://codereview.chromium.org/366883003/