[whatwg/dom] Default value for node document or always set it explicitly (#212)

https://dom.spec.whatwg.org/#concept-node-document
"Each node has an associated node document, set upon creation, that is a document."
So every time when we create new node we must set node document for this node. But in some case you don't do this:

https://dom.spec.whatwg.org/#dom-element-insertadjacenttext
1. Let text be a new Text object whose data is data. < btw, you can change this to "new Text node" (and linked /Text/ and /node/) like in any other case.
Of course finally this new Text node will have correct node document because in step 2. we run "insert adjacent" which use "adopt" but it does not fit to definition node document.

Other similar cases:
https://dom.spec.whatwg.org/#dom-node-textcontent < setter
https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument << this is more interesting because you also use new element (html/head/title/body) but it's to general, how you create them (using "create an element" algorithm)? After changing definition around Element (due to custom elements) I don't see that default value for namespace and namespace prefix is null.
 
Maybe define default value for node document to global object’s associated document for other node than document and for document use himself (or something else more uniwersal) and change it explicitly in other algorithms only when necessary? If no then node document should always be set explicitly when node is created in some cases, even if for the moment will be automatically changed by other step in algorithm because that is the definition of node document, but it's a little uncomfortable.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/212

Received on Saturday, 9 April 2016 13:53:29 UTC