Document Object Model (DOM) Level 1 Specification http://www.w3.org/TR/REC-DOM-Level-1/ In the DOM, documents have a logical structure which is very much like a tree; to be more precise, it is like a “forest” or “grove”, which can contain more than one tree. However, the DOM does not specify that documents must be implemented as a tree or a grove, nor does it specify how the relationships among objects be implemented.
What the Document Object Model is not • “…it does not implement all of ‘Dynamic HTML’.” • “The Document Object Model is not a binary specification.” • “The Document Object Model is not a way of persisting objects to XML or HTML.” • “The Document Object Model is not a set of data structures, it is an object model that specifies interfaces.” • “The Document Object Model does not define ‘the true inner semantics’ of XML or HTML.” • “The Document Object Model…is not a competitor to the Component Object Model (COM).”
Document Object Model (DOM) Level 2 Traversal and Range Specification http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined by their whatToShow flags and filter (if any).
var walker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, function (n) { return NodeFilter.FILTER_ACCEPT; }); do { doSomething(walker.currentNode); } while (walker.nextNode());
DocumentFragment is a “lightweight” or “minimal” Document object. It is very common to want to be able to extract a portion of a document’s tree or to create a new fragment of a document. Document Object Model (DOM) Level 1 Specification http://www.w3.org/TR/REC-DOM-Level-1/
When a DocumentFragment is inserted into a Document…the children of the DocumentFragment and not the DocumentFragment itself are inserted into the Node. Document Object Model (DOM) Level 1 Specification http://www.w3.org/TR/REC-DOM-Level-1/
do { diff = diffs.pop(); if (diff[0].isEqualNode(diff[1])) break; if (diff[0].parentNode) { diff[0].parentNode.replaceChild( diff[1].cloneNode(true), diff[0]); } } while (diffs.length) https://gist.github.com/mwunsch/29bca83eaf7649873900
do { diff = diffs.pop() if (diff[0].isEqualNode(diff[1])) break if (diff[0].parentNode) { diff[0].parentNode.replaceChild( diff[1].cloneNode(true) diff[0]) } } while (diffs.length) https://gist.github.com/mwunsch/29bca83eaf7649873900 CO NSIDERED HARM FUL
var el = document.getElementById("grid-thumb-viv9"), loc = new Zipper(el); var designer = location .goDown() .goDown() .goRight() .goDown(); https://gist.github.com/mwunsch/d46a4ebde8567e2e5102 >> Zipper { tree: div.thumb-designer, crumb: Breadcrumb }