1 // This object will be used as the prototype for Nodes when creating a
2 // DOM-Level-1-compliant structure.
3 var NodePrototype = module.exports = {
5 var children = this.children;
6 return children && children[0] || null;
9 var children = this.children;
10 return children && children[children.length - 1] || null;
13 return nodeTypes[this.type] || nodeTypes.element;
19 childNodes: "children",
21 previousSibling: "prev",
33 Object.keys(domLvl1).forEach(function(key) {
34 var shorthand = domLvl1[key];
35 Object.defineProperty(NodePrototype, key, {
37 return this[shorthand] || null;
40 this[shorthand] = val;