pseudo-dom 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/README.md +686 -241
  2. package/browser/pseudo-dom.js +3576 -735
  3. package/browser/pseudo-dom.min.js +1 -1
  4. package/dist/classes/PseudoEventListener.d.ts +96 -96
  5. package/dist/classes/PseudoEventListener.js +151 -151
  6. package/dist/classes/PseudoHTMLDocument.d.ts +17 -43
  7. package/dist/classes/PseudoHTMLDocument.js +24 -94
  8. package/dist/classes/PseudoHTMLDocument.min.js +1 -1
  9. package/dist/classes/PseudoNodeList.d.ts +34 -34
  10. package/dist/classes/PseudoNodeList.js +71 -71
  11. package/dist/factories/createEvent.d.ts +28 -28
  12. package/dist/factories/createEvent.js +56 -56
  13. package/dist/factories/cssSelectAdapter.d.ts +23 -0
  14. package/dist/factories/cssSelectAdapter.js +87 -0
  15. package/dist/factories/cssSelectAdapter.min.js +1 -0
  16. package/dist/factories/eventDefaults.d.ts +31 -31
  17. package/dist/factories/eventDefaults.js +105 -105
  18. package/dist/factories/generateDocument.d.ts +11 -11
  19. package/dist/factories/generateDocument.js +65 -65
  20. package/dist/factories/generateNodeList.d.ts +9 -9
  21. package/dist/factories/generateNodeList.js +13 -13
  22. package/dist/factories/query.d.ts +33 -0
  23. package/dist/factories/query.js +66 -0
  24. package/dist/factories/query.min.js +1 -0
  25. package/dist/functions/activeElement.d.ts +14 -14
  26. package/dist/functions/activeElement.js +33 -33
  27. package/dist/functions/getElementById.d.ts +13 -0
  28. package/dist/functions/getElementById.js +33 -0
  29. package/dist/functions/getElementById.min.js +1 -0
  30. package/dist/functions/getParentNodes.d.ts +11 -11
  31. package/dist/functions/getParentNodes.js +22 -22
  32. package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
  33. package/dist/functions/getParentNodesFromAttribute.js +29 -29
  34. package/dist/functions/modifierState.d.ts +29 -29
  35. package/dist/functions/modifierState.js +41 -41
  36. package/dist/interfaces/PseudoAnimation.d.ts +3 -3
  37. package/dist/interfaces/PseudoAnimation.js +5 -5
  38. package/dist/interfaces/PseudoAttr.d.ts +11 -11
  39. package/dist/interfaces/PseudoAttr.js +5 -5
  40. package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
  41. package/dist/interfaces/PseudoDOMTokenList.js +5 -5
  42. package/dist/interfaces/PseudoDocument.d.ts +32 -0
  43. package/dist/interfaces/PseudoDocument.js +5 -5
  44. package/dist/interfaces/PseudoDocumentFragment.d.ts +7 -0
  45. package/dist/interfaces/PseudoDocumentFragment.js +5 -5
  46. package/dist/interfaces/PseudoElement.d.ts +702 -689
  47. package/dist/interfaces/PseudoElement.js +5 -5
  48. package/dist/interfaces/PseudoEvent.d.ts +79 -79
  49. package/dist/interfaces/PseudoEvent.js +10 -10
  50. package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
  51. package/dist/interfaces/PseudoEventTarget.js +5 -5
  52. package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -23
  53. package/dist/interfaces/PseudoHTMLCollection.js +5 -5
  54. package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
  55. package/dist/interfaces/PseudoHTMLElement.js +5 -5
  56. package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
  57. package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
  58. package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
  59. package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
  60. package/dist/interfaces/PseudoNode.d.ts +179 -179
  61. package/dist/interfaces/PseudoNode.js +5 -5
  62. package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
  63. package/dist/interfaces/PseudoShadowRoot.js +5 -5
  64. package/dist/main.d.ts +63 -63
  65. package/dist/main.js +155 -155
  66. package/dist/services/AnimationService.d.ts +4 -4
  67. package/dist/services/AnimationService.js +16 -16
  68. package/dist/services/AttrService.d.ts +37 -37
  69. package/dist/services/AttrService.js +81 -81
  70. package/dist/services/CommentService.d.ts +1 -1
  71. package/dist/services/CommentService.js +13 -13
  72. package/dist/services/CustomEventService.d.ts +37 -37
  73. package/dist/services/CustomEventService.js +35 -35
  74. package/dist/services/DOMTokenListService.d.ts +33 -33
  75. package/dist/services/DOMTokenListService.js +117 -117
  76. package/dist/services/DocumentFragmentService.d.ts +8 -0
  77. package/dist/services/DocumentFragmentService.js +18 -0
  78. package/dist/services/DocumentFragmentService.min.js +1 -1
  79. package/dist/services/DocumentService.d.ts +35 -1
  80. package/dist/services/DocumentService.js +72 -0
  81. package/dist/services/DocumentService.min.js +1 -1
  82. package/dist/services/ElementService.d.ts +191 -178
  83. package/dist/services/ElementService.js +426 -406
  84. package/dist/services/ElementService.min.js +1 -1
  85. package/dist/services/EventService.d.ts +120 -120
  86. package/dist/services/EventService.js +250 -250
  87. package/dist/services/EventTargetService.d.ts +84 -84
  88. package/dist/services/EventTargetService.js +232 -232
  89. package/dist/services/FocusEventService.d.ts +32 -32
  90. package/dist/services/FocusEventService.js +35 -35
  91. package/dist/services/HTMLCollectionService.d.ts +54 -49
  92. package/dist/services/HTMLCollectionService.js +92 -75
  93. package/dist/services/HTMLCollectionService.min.js +1 -1
  94. package/dist/services/HTMLElementService.d.ts +57 -57
  95. package/dist/services/HTMLElementService.js +163 -163
  96. package/dist/services/HTMLSlotElementService.d.ts +4 -4
  97. package/dist/services/HTMLSlotElementService.js +9 -9
  98. package/dist/services/InputEventService.d.ts +41 -41
  99. package/dist/services/InputEventService.js +47 -47
  100. package/dist/services/KeyboardEventService.d.ts +70 -70
  101. package/dist/services/KeyboardEventService.js +86 -86
  102. package/dist/services/MouseEventService.d.ts +80 -80
  103. package/dist/services/MouseEventService.js +108 -108
  104. package/dist/services/NamedNodeMapService.d.ts +23 -23
  105. package/dist/services/NamedNodeMapService.js +77 -77
  106. package/dist/services/NodeService.d.ts +297 -271
  107. package/dist/services/NodeService.js +721 -679
  108. package/dist/services/NodeService.min.js +1 -1
  109. package/dist/services/PointerEventService.d.ts +51 -51
  110. package/dist/services/PointerEventService.js +67 -67
  111. package/dist/services/ShadowRootService.d.ts +4 -4
  112. package/dist/services/ShadowRootService.js +9 -9
  113. package/dist/services/TextService.d.ts +1 -1
  114. package/dist/services/TextService.js +13 -13
  115. package/dist/services/UIEventService.d.ts +43 -43
  116. package/dist/services/UIEventService.js +42 -42
  117. package/dist/simulate.d.ts +32 -32
  118. package/dist/simulate.js +115 -115
  119. package/package.json +4 -3
  120. package/dist/classes.d.ts +0 -20
  121. package/dist/classes.js +0 -31
  122. package/dist/classes.min.js +0 -1
  123. package/dist/factories/generateNode.d.ts +0 -32
  124. package/dist/factories/generateNode.js +0 -85
  125. package/dist/factories/generateNode.min.js +0 -1
  126. package/dist/factories.d.ts +0 -11
  127. package/dist/factories.js +0 -27
  128. package/dist/factories.min.js +0 -1
  129. package/dist/functions.d.ts +0 -5
  130. package/dist/functions.js +0 -23
  131. package/dist/functions.min.js +0 -1
package/README.md CHANGED
@@ -45,9 +45,21 @@ children, \`childElementCount\`, \`firstElementChild\` / \`lastElementChild\` an
45
45
  a tree rather than duplicating it; \`insertAdjacentElement\` / \`insertAdjacentText\` insert at beforebegin / afterbegin
46
46
  / beforeend / afterend (\`insertAdjacentHTML\` is not implemented, no HTML parsing yet).
47
47
 
48
- Not implemented yet (these throw a "not implemented" error or are missing): `querySelector` /
49
- `querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the Element and Document APIs. The API
50
- will change before 1.0.
48
+ Selector queries work like the DOM's: \`getElementsByTagName\` / \`getElementsByClassName\` (live, on any node) and
49
+ \`querySelector\` / \`querySelectorAll\` (real CSS selectors, via [css-select](https://www.npmjs.com/package/css-select)
50
+ matched against pseudo-dom's own tree through a custom adapter - \`querySelectorAll\` is a plain array, a snapshot
51
+ taken when it is called, like the DOM's) are on \`NodeService\` so \`Document\`, \`DocumentFragment\` and \`Element\`
52
+ all have them; \`matches\` / \`closest\` are on \`ElementService\`; \`getElementById\` is on both \`DocumentService\`
53
+ and \`DocumentFragmentService\` (the DOM's \`NonElementParentNode\` mixin, so a \`ShadowRoot\` gets it too), matching
54
+ the real DOM.
55
+
56
+ \`DocumentService\` matches the real \`Document\` (it is not an \`Element\`, so it has no \`tagName\` / \`classList\` /
57
+ \`matches\` / etc.): \`createElement\`, \`createTextNode\`, \`createComment\`, \`createDocumentFragment\`,
58
+ \`getElementById\`, and \`textContent\` always \`null\`. \`PseudoHTMLDocument\` (what \`generateDocument\` actually
59
+ creates) only adds the \`html\` / \`head\` / \`body\` structure on top.
60
+
61
+ Not implemented yet (these throw a "not implemented" error or are missing): \`getElementsByTagNameNS\`, \`innerHTML\` /
62
+ \`outerHTML\` parsing, and most of the rest of the Element and Document APIs. The API will change before 1.0.
51
63
  ## Modules
52
64
 
53
65
  <dl>
@@ -94,8 +106,8 @@ interface (the mouse, the keyboard, focus and input).</p>
94
106
  <dd><p>Simulate the behaviour of the HTMLElement Class when there is no DOM available.</p>
95
107
  </dd>
96
108
  <dt><a href="#HTMLCollectionService">HTMLCollectionService</a></dt>
97
- <dd><p>Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of the element
98
- children of a node, recomputed from its childNodes each time it is used rather than kept in sync as they change.</p>
109
+ <dd><p>Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of some of a node&#39;s
110
+ element descendants, recomputed each time it is used rather than kept in sync as they change.</p>
99
111
  </dd>
100
112
  <dt><a href="#FocusEventService">FocusEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
101
113
  <dd><p>Simulate the behaviour of the FocusEvent Class when there is no DOM available.</p>
@@ -128,16 +140,14 @@ not part of a tree, when it is inserted its children are moved into the tree ins
128
140
  <dt><a href="#AttrService">AttrService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
129
141
  <dd><p>Simulate the behaviour of the Attr Class when there is no DOM available.</p>
130
142
  </dd>
131
- <dt><a href="#LinkedNode">LinkedNode</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
132
- <dd><p>A node which is stored in a TreeLinker (for example by a list built from an array of values). It finds its siblings
133
- from that linker, and its parent from the linker&#39;s parent when it has not been given one by appendChild.</p>
134
- </dd>
135
143
  <dt><a href="#PseudoNodeList">PseudoNodeList</a> ⇐ <code>LinkedTreeList</code></dt>
136
144
  <dd><p>A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
137
145
  the linkers that hold them.</p>
138
146
  </dd>
139
- <dt><a href="#PseudoHTMLDocument">PseudoHTMLDocument</a> ⇐ <code>PseudoHTMLElement</code></dt>
140
- <dd><p>Simulate the behaviour of the HTMLDocument Class when there is no DOM available.</p>
147
+ <dt><a href="#PseudoHTMLDocument">PseudoHTMLDocument</a> ⇐ <code><a href="#DocumentService">DocumentService</a></code></dt>
148
+ <dd><p>Simulate the behaviour of the HTMLDocument Class when there is no DOM available. Like the real HTMLDocument, this
149
+ only adds the html/head/body structure on top of what Document already gives (createElement, createTextNode,
150
+ createComment, createDocumentFragment, getElementById, textContent always null).</p>
141
151
  </dd>
142
152
  <dt><a href="#PseudoEventListener">PseudoEventListener</a></dt>
143
153
  <dd><p>Handle events as they are stored and implemented.</p>
@@ -161,8 +171,6 @@ The values follow the UI Events, HTML, Pointer Events, Clipboard, Drag and Drop,
161
171
  <dt><a href="#focused">focused</a></dt>
162
172
  <dd><p>The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.</p>
163
173
  </dd>
164
- <dt><a href="#HTMLElementService_1">HTMLElementService_1</a> : <code>PseudoHTMLElement</code></dt>
165
- <dd></dd>
166
174
  </dl>
167
175
 
168
176
  ## Functions
@@ -192,14 +200,13 @@ order in which an event travels down through them). A node which has no parent h
192
200
  <dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
193
201
  <dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
194
202
  </dd>
195
- <dt><a href="#generateNode">generateNode()</a> ⇒ <code>function</code></dt>
196
- <dd><p>Create a TreeLinker class whose linkers each store a node (a LinkedNode) as their data, this can be used to build a
197
- tree (or list) of nodes from plain values.</p>
198
- </dd>
199
203
  <dt><a href="#generateDocument">generateDocument(root, context)</a> ⇒ <code>Window</code> | <code>PseudoEventTarget</code></dt>
200
204
  <dd><p>Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
201
205
  context.</p>
202
206
  </dd>
207
+ <dt><a href="#nearestElementSibling">nearestElementSibling(node, direction)</a> ⇒ <code>*</code> | <code>null</code></dt>
208
+ <dd><p>Walk up from a node (not including it) to find the nearest element, in the given direction.</p>
209
+ </dd>
203
210
  <dt><a href="#createEvent">createEvent(type, [init], [options])</a> ⇒ <code><a href="#EventService">EventService</a></code></dt>
204
211
  <dd><p>Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
205
212
  By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
@@ -456,6 +463,10 @@ Simulate the behaviour of the Node Class when there is no DOM available.
456
463
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
457
464
  * [.remove()](#NodeService+remove)
458
465
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
466
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
467
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
468
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
469
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
459
470
  * [.childInserted(child)](#NodeService+childInserted)
460
471
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
461
472
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -602,6 +613,51 @@ becomes a text node belonging to this node's document, anything else is returned
602
613
  | --- | --- | --- |
603
614
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
604
615
 
616
+ <a name="NodeService+getElementsByTagName"></a>
617
+
618
+ ### nodeService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
619
+ Every element below this node with the given tag name (or every element when tagName is *), live.
620
+
621
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
622
+
623
+ | Param | Type |
624
+ | --- | --- |
625
+ | tagName | <code>string</code> |
626
+
627
+ <a name="NodeService+getElementsByClassName"></a>
628
+
629
+ ### nodeService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
630
+ Every element below this node which has all of the given (space separated) classes, live.
631
+
632
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
633
+
634
+ | Param | Type |
635
+ | --- | --- |
636
+ | className | <code>string</code> |
637
+
638
+ <a name="NodeService+querySelector"></a>
639
+
640
+ ### nodeService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
641
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
642
+
643
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
644
+
645
+ | Param | Type | Description |
646
+ | --- | --- | --- |
647
+ | selectors | <code>string</code> | A CSS selector |
648
+
649
+ <a name="NodeService+querySelectorAll"></a>
650
+
651
+ ### nodeService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
652
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
653
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
654
+
655
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
656
+
657
+ | Param | Type | Description |
658
+ | --- | --- | --- |
659
+ | selectors | <code>string</code> | A CSS selector |
660
+
605
661
  <a name="NodeService+childInserted"></a>
606
662
 
607
663
  ### nodeService.childInserted(child)
@@ -752,6 +808,10 @@ Simulate the behaviour of the Text Class when there is no DOM available: the tex
752
808
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
753
809
  * [.remove()](#NodeService+remove)
754
810
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
811
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
812
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
813
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
814
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
755
815
  * [.childInserted(child)](#NodeService+childInserted)
756
816
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
757
817
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -935,6 +995,55 @@ becomes a text node belonging to this node's document, anything else is returned
935
995
  | --- | --- | --- |
936
996
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
937
997
 
998
+ <a name="NodeService+getElementsByTagName"></a>
999
+
1000
+ ### textService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
1001
+ Every element below this node with the given tag name (or every element when tagName is *), live.
1002
+
1003
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1004
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
1005
+
1006
+ | Param | Type |
1007
+ | --- | --- |
1008
+ | tagName | <code>string</code> |
1009
+
1010
+ <a name="NodeService+getElementsByClassName"></a>
1011
+
1012
+ ### textService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
1013
+ Every element below this node which has all of the given (space separated) classes, live.
1014
+
1015
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1016
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
1017
+
1018
+ | Param | Type |
1019
+ | --- | --- |
1020
+ | className | <code>string</code> |
1021
+
1022
+ <a name="NodeService+querySelector"></a>
1023
+
1024
+ ### textService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
1025
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
1026
+
1027
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1028
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
1029
+
1030
+ | Param | Type | Description |
1031
+ | --- | --- | --- |
1032
+ | selectors | <code>string</code> | A CSS selector |
1033
+
1034
+ <a name="NodeService+querySelectorAll"></a>
1035
+
1036
+ ### textService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1037
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
1038
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
1039
+
1040
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1041
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
1042
+
1043
+ | Param | Type | Description |
1044
+ | --- | --- | --- |
1045
+ | selectors | <code>string</code> | A CSS selector |
1046
+
938
1047
  <a name="NodeService+childInserted"></a>
939
1048
 
940
1049
  ### textService.childInserted(child)
@@ -1092,6 +1201,10 @@ Simulate the behaviour of the Comment Class when there is no DOM available: a no
1092
1201
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
1093
1202
  * [.remove()](#NodeService+remove)
1094
1203
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
1204
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
1205
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
1206
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
1207
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1095
1208
  * [.childInserted(child)](#NodeService+childInserted)
1096
1209
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
1097
1210
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -1258,6 +1371,55 @@ becomes a text node belonging to this node's document, anything else is returned
1258
1371
  | --- | --- | --- |
1259
1372
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
1260
1373
 
1374
+ <a name="NodeService+getElementsByTagName"></a>
1375
+
1376
+ ### commentService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
1377
+ Every element below this node with the given tag name (or every element when tagName is *), live.
1378
+
1379
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1380
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
1381
+
1382
+ | Param | Type |
1383
+ | --- | --- |
1384
+ | tagName | <code>string</code> |
1385
+
1386
+ <a name="NodeService+getElementsByClassName"></a>
1387
+
1388
+ ### commentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
1389
+ Every element below this node which has all of the given (space separated) classes, live.
1390
+
1391
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1392
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
1393
+
1394
+ | Param | Type |
1395
+ | --- | --- |
1396
+ | className | <code>string</code> |
1397
+
1398
+ <a name="NodeService+querySelector"></a>
1399
+
1400
+ ### commentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
1401
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
1402
+
1403
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1404
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
1405
+
1406
+ | Param | Type | Description |
1407
+ | --- | --- | --- |
1408
+ | selectors | <code>string</code> | A CSS selector |
1409
+
1410
+ <a name="NodeService+querySelectorAll"></a>
1411
+
1412
+ ### commentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1413
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
1414
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
1415
+
1416
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1417
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
1418
+
1419
+ | Param | Type | Description |
1420
+ | --- | --- | --- |
1421
+ | selectors | <code>string</code> | A CSS selector |
1422
+
1261
1423
  <a name="NodeService+childInserted"></a>
1262
1424
 
1263
1425
  ### commentService.childInserted(child)
@@ -1715,14 +1877,14 @@ Take the focus away from the element, when it has it: it gets blur then focusout
1715
1877
  <a name="HTMLCollectionService"></a>
1716
1878
 
1717
1879
  ## HTMLCollectionService
1718
- Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of the element
1719
- children of a node, recomputed from its childNodes each time it is used rather than kept in sync as they change.
1880
+ Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of some of a node's
1881
+ element descendants, recomputed each time it is used rather than kept in sync as they change.
1720
1882
 
1721
1883
  **Kind**: global class
1722
1884
  **Author**: Joshua Heagle <joshuaheagle@gmail.com>
1723
1885
 
1724
1886
  * [HTMLCollectionService](#HTMLCollectionService)
1725
- * [new HTMLCollectionService(owner)](#new_HTMLCollectionService_new)
1887
+ * [new HTMLCollectionService(owner, [predicate], [deep])](#new_HTMLCollectionService_new)
1726
1888
  * [.length](#HTMLCollectionService+length) ⇒ <code>number</code>
1727
1889
  * [.elements()](#HTMLCollectionService+elements) ⇒ <code>Array.&lt;PseudoNode&gt;</code>
1728
1890
  * [.item(index)](#HTMLCollectionService+item) ⇒ <code>\*</code>
@@ -1730,11 +1892,13 @@ children of a node, recomputed from its childNodes each time it is used rather t
1730
1892
 
1731
1893
  <a name="new_HTMLCollectionService_new"></a>
1732
1894
 
1733
- ### new HTMLCollectionService(owner)
1895
+ ### new HTMLCollectionService(owner, [predicate], [deep])
1734
1896
 
1735
- | Param | Type | Description |
1736
- | --- | --- | --- |
1737
- | owner | [<code>NodeService</code>](#NodeService) | The node whose element children this is a live view of |
1897
+ | Param | Type | Default | Description |
1898
+ | --- | --- | --- | --- |
1899
+ | owner | [<code>NodeService</code>](#NodeService) | | The node this is a live view of a part of |
1900
+ | [predicate] | <code>function</code> | | Only elements which pass this are included (every element by default) |
1901
+ | [deep] | <code>boolean</code> | <code>false</code> | Include every matching descendant (true, like getElementsByTagName), not just the direct element children (false, like Element.children) |
1738
1902
 
1739
1903
  <a name="HTMLCollectionService+length"></a>
1740
1904
 
@@ -1745,7 +1909,7 @@ How many elements are in the collection right now.
1745
1909
  <a name="HTMLCollectionService+elements"></a>
1746
1910
 
1747
1911
  ### htmlCollectionService.elements() ⇒ <code>Array.&lt;PseudoNode&gt;</code>
1748
- The current element children of the owner, in order.
1912
+ The current elements the collection holds, in tree order.
1749
1913
 
1750
1914
  **Kind**: instance method of [<code>HTMLCollectionService</code>](#HTMLCollectionService)
1751
1915
  <a name="HTMLCollectionService+item"></a>
@@ -2085,6 +2249,8 @@ Simulate the behaviour of the Element Class when there is no DOM available.
2085
2249
  * [.insertAdjacentText(position, text)](#ElementService+insertAdjacentText)
2086
2250
  * [.insertAdjacent(position, node)](#ElementService+insertAdjacent) ⇒ <code>PseudoNode</code> \| <code>null</code>
2087
2251
  * [.insertAdjacentHTML(position, text)](#ElementService+insertAdjacentHTML)
2252
+ * [.matches(selectors)](#ElementService+matches) ⇒ <code>boolean</code>
2253
+ * [.closest(selectors)](#ElementService+closest) ⇒ <code>PseudoElement</code> \| <code>null</code>
2088
2254
  * [.childInserted(child)](#ElementService+childInserted)
2089
2255
  * [.hasAttribute(attributeName)](#ElementService+hasAttribute) ⇒ <code>boolean</code>
2090
2256
  * [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
@@ -2233,6 +2399,29 @@ Not implemented yet (HTML parsing is out of scope for now).
2233
2399
  | position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
2234
2400
  | text | <code>string</code> | The markup which would be parsed |
2235
2401
 
2402
+ <a name="ElementService+matches"></a>
2403
+
2404
+ ### elementService.matches(selectors) ⇒ <code>boolean</code>
2405
+ Whether this element itself (not its descendants) matches the given CSS selector.
2406
+
2407
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2408
+
2409
+ | Param | Type | Description |
2410
+ | --- | --- | --- |
2411
+ | selectors | <code>string</code> | A CSS selector |
2412
+
2413
+ <a name="ElementService+closest"></a>
2414
+
2415
+ ### elementService.closest(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
2416
+ The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or
2417
+ null when none of them do.
2418
+
2419
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2420
+
2421
+ | Param | Type | Description |
2422
+ | --- | --- | --- |
2423
+ | selectors | <code>string</code> | A CSS selector |
2424
+
2236
2425
  <a name="ElementService+childInserted"></a>
2237
2426
 
2238
2427
  ### elementService.childInserted(child)
@@ -2301,6 +2490,11 @@ Simulate the behaviour of the Document Class when there is no DOM available.
2301
2490
 
2302
2491
  * [DocumentService](#DocumentService) ⇐ [<code>NodeService</code>](#NodeService)
2303
2492
  * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
2493
+ * [.getElementById(id)](#DocumentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
2494
+ * [.createElement([tagName])](#DocumentService+createElement) ⇒ <code>PseudoElement</code>
2495
+ * [.createTextNode([data])](#DocumentService+createTextNode) ⇒ [<code>TextService</code>](#TextService)
2496
+ * [.createComment([data])](#DocumentService+createComment) ⇒ [<code>CommentService</code>](#CommentService)
2497
+ * [.createDocumentFragment()](#DocumentService+createDocumentFragment) ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2304
2498
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2305
2499
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2306
2500
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
@@ -2312,6 +2506,10 @@ Simulate the behaviour of the Document Class when there is no DOM available.
2312
2506
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
2313
2507
  * [.remove()](#NodeService+remove)
2314
2508
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
2509
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
2510
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
2511
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
2512
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2315
2513
  * [.childInserted(child)](#NodeService+childInserted)
2316
2514
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2317
2515
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -2328,6 +2526,57 @@ Simulate the behaviour of the Document Class when there is no DOM available.
2328
2526
  Whether this kind of node can have children (text, comments and attributes cannot).
2329
2527
 
2330
2528
  **Kind**: instance property of [<code>DocumentService</code>](#DocumentService)
2529
+ <a name="DocumentService+getElementById"></a>
2530
+
2531
+ ### documentService.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
2532
+ The first element, in tree order, whose id matches the given value, or null when there is none.
2533
+
2534
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2535
+
2536
+ | Param | Type |
2537
+ | --- | --- |
2538
+ | id | <code>string</code> |
2539
+
2540
+ <a name="DocumentService+createElement"></a>
2541
+
2542
+ ### documentService.createElement([tagName]) ⇒ <code>PseudoElement</code>
2543
+ Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
2544
+
2545
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2546
+
2547
+ | Param | Type | Default | Description |
2548
+ | --- | --- | --- | --- |
2549
+ | [tagName] | <code>string</code> | <code>&quot;&#x27;div&#x27;&quot;</code> | The type of element to create |
2550
+
2551
+ <a name="DocumentService+createTextNode"></a>
2552
+
2553
+ ### documentService.createTextNode([data]) ⇒ [<code>TextService</code>](#TextService)
2554
+ Make a text node which belongs to this document.
2555
+
2556
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2557
+
2558
+ | Param | Type | Default | Description |
2559
+ | --- | --- | --- | --- |
2560
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The text |
2561
+
2562
+ <a name="DocumentService+createComment"></a>
2563
+
2564
+ ### documentService.createComment([data]) ⇒ [<code>CommentService</code>](#CommentService)
2565
+ Make a comment which belongs to this document.
2566
+
2567
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2568
+
2569
+ | Param | Type | Default | Description |
2570
+ | --- | --- | --- | --- |
2571
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The comment |
2572
+
2573
+ <a name="DocumentService+createDocumentFragment"></a>
2574
+
2575
+ ### documentService.createDocumentFragment() ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2576
+ Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
2577
+ then inserted in one go.
2578
+
2579
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2331
2580
  <a name="NodeService+appendChild"></a>
2332
2581
 
2333
2582
  ### documentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -2458,6 +2707,51 @@ becomes a text node belonging to this node's document, anything else is returned
2458
2707
  | --- | --- | --- |
2459
2708
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
2460
2709
 
2710
+ <a name="NodeService+getElementsByTagName"></a>
2711
+
2712
+ ### documentService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
2713
+ Every element below this node with the given tag name (or every element when tagName is *), live.
2714
+
2715
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2716
+
2717
+ | Param | Type |
2718
+ | --- | --- |
2719
+ | tagName | <code>string</code> |
2720
+
2721
+ <a name="NodeService+getElementsByClassName"></a>
2722
+
2723
+ ### documentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
2724
+ Every element below this node which has all of the given (space separated) classes, live.
2725
+
2726
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2727
+
2728
+ | Param | Type |
2729
+ | --- | --- |
2730
+ | className | <code>string</code> |
2731
+
2732
+ <a name="NodeService+querySelector"></a>
2733
+
2734
+ ### documentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
2735
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
2736
+
2737
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2738
+
2739
+ | Param | Type | Description |
2740
+ | --- | --- | --- |
2741
+ | selectors | <code>string</code> | A CSS selector |
2742
+
2743
+ <a name="NodeService+querySelectorAll"></a>
2744
+
2745
+ ### documentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2746
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
2747
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
2748
+
2749
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2750
+
2751
+ | Param | Type | Description |
2752
+ | --- | --- | --- |
2753
+ | selectors | <code>string</code> | A CSS selector |
2754
+
2461
2755
  <a name="NodeService+childInserted"></a>
2462
2756
 
2463
2757
  ### documentService.childInserted(child)
@@ -2588,6 +2882,7 @@ not part of a tree, when it is inserted its children are moved into the tree ins
2588
2882
 
2589
2883
  * [DocumentFragmentService](#DocumentFragmentService) ⇐ [<code>NodeService</code>](#NodeService)
2590
2884
  * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
2885
+ * [.getElementById(id)](#DocumentFragmentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
2591
2886
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2592
2887
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2593
2888
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
@@ -2599,6 +2894,10 @@ not part of a tree, when it is inserted its children are moved into the tree ins
2599
2894
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
2600
2895
  * [.remove()](#NodeService+remove)
2601
2896
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
2897
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
2898
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
2899
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
2900
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2602
2901
  * [.childInserted(child)](#NodeService+childInserted)
2603
2902
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2604
2903
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -2615,6 +2914,18 @@ not part of a tree, when it is inserted its children are moved into the tree ins
2615
2914
  Whether this kind of node can have children (text, comments and attributes cannot).
2616
2915
 
2617
2916
  **Kind**: instance property of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2917
+ <a name="DocumentFragmentService+getElementById"></a>
2918
+
2919
+ ### documentFragmentService.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
2920
+ The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
2921
+ NonElementParentNode mixin, which Document and DocumentFragment both implement).
2922
+
2923
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2924
+
2925
+ | Param | Type |
2926
+ | --- | --- |
2927
+ | id | <code>string</code> |
2928
+
2618
2929
  <a name="NodeService+appendChild"></a>
2619
2930
 
2620
2931
  ### documentFragmentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -2745,6 +3056,51 @@ becomes a text node belonging to this node's document, anything else is returned
2745
3056
  | --- | --- | --- |
2746
3057
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
2747
3058
 
3059
+ <a name="NodeService+getElementsByTagName"></a>
3060
+
3061
+ ### documentFragmentService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
3062
+ Every element below this node with the given tag name (or every element when tagName is *), live.
3063
+
3064
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3065
+
3066
+ | Param | Type |
3067
+ | --- | --- |
3068
+ | tagName | <code>string</code> |
3069
+
3070
+ <a name="NodeService+getElementsByClassName"></a>
3071
+
3072
+ ### documentFragmentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
3073
+ Every element below this node which has all of the given (space separated) classes, live.
3074
+
3075
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3076
+
3077
+ | Param | Type |
3078
+ | --- | --- |
3079
+ | className | <code>string</code> |
3080
+
3081
+ <a name="NodeService+querySelector"></a>
3082
+
3083
+ ### documentFragmentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
3084
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
3085
+
3086
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3087
+
3088
+ | Param | Type | Description |
3089
+ | --- | --- | --- |
3090
+ | selectors | <code>string</code> | A CSS selector |
3091
+
3092
+ <a name="NodeService+querySelectorAll"></a>
3093
+
3094
+ ### documentFragmentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3095
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
3096
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
3097
+
3098
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3099
+
3100
+ | Param | Type | Description |
3101
+ | --- | --- | --- |
3102
+ | selectors | <code>string</code> | A CSS selector |
3103
+
2748
3104
  <a name="NodeService+childInserted"></a>
2749
3105
 
2750
3106
  ### documentFragmentService.childInserted(child)
@@ -2971,6 +3327,10 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
2971
3327
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
2972
3328
  * [.remove()](#NodeService+remove)
2973
3329
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
3330
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
3331
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
3332
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
3333
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2974
3334
  * [.childInserted(child)](#NodeService+childInserted)
2975
3335
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2976
3336
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -3141,6 +3501,55 @@ becomes a text node belonging to this node's document, anything else is returned
3141
3501
  | --- | --- | --- |
3142
3502
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
3143
3503
 
3504
+ <a name="NodeService+getElementsByTagName"></a>
3505
+
3506
+ ### attrService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
3507
+ Every element below this node with the given tag name (or every element when tagName is *), live.
3508
+
3509
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3510
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
3511
+
3512
+ | Param | Type |
3513
+ | --- | --- |
3514
+ | tagName | <code>string</code> |
3515
+
3516
+ <a name="NodeService+getElementsByClassName"></a>
3517
+
3518
+ ### attrService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
3519
+ Every element below this node which has all of the given (space separated) classes, live.
3520
+
3521
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3522
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
3523
+
3524
+ | Param | Type |
3525
+ | --- | --- |
3526
+ | className | <code>string</code> |
3527
+
3528
+ <a name="NodeService+querySelector"></a>
3529
+
3530
+ ### attrService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
3531
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
3532
+
3533
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3534
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
3535
+
3536
+ | Param | Type | Description |
3537
+ | --- | --- | --- |
3538
+ | selectors | <code>string</code> | A CSS selector |
3539
+
3540
+ <a name="NodeService+querySelectorAll"></a>
3541
+
3542
+ ### attrService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3543
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
3544
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
3545
+
3546
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3547
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
3548
+
3549
+ | Param | Type | Description |
3550
+ | --- | --- | --- |
3551
+ | selectors | <code>string</code> | A CSS selector |
3552
+
3144
3553
  <a name="NodeService+childInserted"></a>
3145
3554
 
3146
3555
  ### attrService.childInserted(child)
@@ -3268,21 +3677,69 @@ Replace a child of this node with another node (which is moved if it is already
3268
3677
  | newChild | <code>PseudoNode</code> | The node which takes the place |
3269
3678
  | oldChild | <code>PseudoNode</code> | The child of this node to replace |
3270
3679
 
3271
- <a name="LinkedNode"></a>
3680
+ <a name="PseudoNodeList"></a>
3272
3681
 
3273
- ## LinkedNode ⇐ [<code>NodeService</code>](#NodeService)
3274
- A node which is stored in a TreeLinker (for example by a list built from an array of values). It finds its siblings
3275
- from that linker, and its parent from the linker's parent when it has not been given one by appendChild.
3682
+ ## PseudoNodeList ⇐ <code>LinkedTreeList</code>
3683
+ A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
3684
+ the linkers that hold them.
3276
3685
 
3277
3686
  **Kind**: global class
3278
- **Extends**: [<code>NodeService</code>](#NodeService)
3279
- **Author**: Joshua Heagle <joshuaheagle@gmail.com>
3687
+ **Extends**: <code>LinkedTreeList</code>
3280
3688
 
3281
- * [LinkedNode](#LinkedNode) ⇐ [<code>NodeService</code>](#NodeService)
3282
- * [new LinkedNode(linker, value)](#new_LinkedNode_new)
3283
- * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
3689
+ * [PseudoNodeList](#PseudoNodeList) ⇐ <code>LinkedTreeList</code>
3690
+ * [.entries()](#PseudoNodeList+entries) ⇒ <code>Iterator</code>
3691
+ * [.keys()](#PseudoNodeList+keys) ⇒ <code>Iterator</code>
3692
+ * [.values()](#PseudoNodeList+values) ⇒ <code>Iterator</code>
3693
+
3694
+ <a name="PseudoNodeList+entries"></a>
3695
+
3696
+ ### pseudoNodeList.entries() ⇒ <code>Iterator</code>
3697
+ Iterate over [index, node] pairs.
3698
+
3699
+ **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3700
+ <a name="PseudoNodeList+keys"></a>
3701
+
3702
+ ### pseudoNodeList.keys() ⇒ <code>Iterator</code>
3703
+ Iterate over the indexes.
3704
+
3705
+ **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3706
+ <a name="PseudoNodeList+values"></a>
3707
+
3708
+ ### pseudoNodeList.values() ⇒ <code>Iterator</code>
3709
+ Iterate over the nodes.
3710
+
3711
+ **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3712
+ <a name="PseudoHTMLDocument"></a>
3713
+
3714
+ ## PseudoHTMLDocument ⇐ [<code>DocumentService</code>](#DocumentService)
3715
+ Simulate the behaviour of the HTMLDocument Class when there is no DOM available. Like the real HTMLDocument, this
3716
+ only adds the html/head/body structure on top of what Document already gives (createElement, createTextNode,
3717
+ createComment, createDocumentFragment, getElementById, textContent always null).
3718
+
3719
+ **Kind**: global class
3720
+ **Extends**: [<code>DocumentService</code>](#DocumentService)
3721
+ **Author**: Joshua Heagle <joshuaheagle@gmail.com>
3722
+ **Properties**
3723
+
3724
+ | Name | Type | Description |
3725
+ | --- | --- | --- |
3726
+ | head | <code>PseudoHTMLElement</code> | A reference to the Head child element |
3727
+ | body | <code>PseudoHTMLElement</code> | A reference to the Body child element |
3728
+
3729
+
3730
+ * [PseudoHTMLDocument](#PseudoHTMLDocument) ⇐ [<code>DocumentService</code>](#DocumentService)
3731
+ * [new PseudoHTMLDocument()](#new_PseudoHTMLDocument_new)
3732
+ * [.head](#PseudoHTMLDocument+head) : <code>PseudoHTMLElement</code>
3733
+ * [.body](#PseudoHTMLDocument+body) : <code>PseudoHTMLElement</code>
3734
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
3735
+ * [.cloneShallow()](#PseudoHTMLDocument+cloneShallow) ⇒ [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3736
+ * [.cloneNode([deep])](#PseudoHTMLDocument+cloneNode) ⇒ [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3737
+ * [.getElementById(id)](#DocumentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
3738
+ * [.createElement([tagName])](#DocumentService+createElement) ⇒ <code>PseudoElement</code>
3739
+ * [.createTextNode([data])](#DocumentService+createTextNode) ⇒ [<code>TextService</code>](#TextService)
3740
+ * [.createComment([data])](#DocumentService+createComment) ⇒ [<code>CommentService</code>](#CommentService)
3741
+ * [.createDocumentFragment()](#DocumentService+createDocumentFragment) ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3284
3742
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
3285
- * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
3286
3743
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
3287
3744
  * [.append(...nodes)](#NodeService+append)
3288
3745
  * [.prepend(...nodes)](#NodeService+prepend)
@@ -3292,8 +3749,11 @@ from that linker, and its parent from the linker's parent when it has not been g
3292
3749
  * [.replaceWith(...nodes)](#NodeService+replaceWith)
3293
3750
  * [.remove()](#NodeService+remove)
3294
3751
  * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
3752
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
3753
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
3754
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
3755
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3295
3756
  * [.childInserted(child)](#NodeService+childInserted)
3296
- * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
3297
3757
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
3298
3758
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
3299
3759
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
@@ -3302,28 +3762,113 @@ from that linker, and its parent from the linker's parent when it has not been g
3302
3762
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
3303
3763
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
3304
3764
 
3305
- <a name="new_LinkedNode_new"></a>
3765
+ <a name="new_PseudoHTMLDocument_new"></a>
3306
3766
 
3307
- ### new LinkedNode(linker, value)
3767
+ ### new PseudoHTMLDocument()
3768
+ The root HTML element is acts as the parent to all HTML elements in the document.
3308
3769
 
3309
- | Param | Type | Description |
3310
- | --- | --- | --- |
3311
- | linker | <code>TreeLinker</code> | The linker holding this node |
3312
- | value | <code>string</code> \| <code>null</code> | The value of the node |
3770
+ <a name="PseudoHTMLDocument+head"></a>
3771
+
3772
+ ### pseudoHTMLDocument.head : <code>PseudoHTMLElement</code>
3773
+ Create document head element
3774
+
3775
+ **Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3776
+ <a name="PseudoHTMLDocument+body"></a>
3777
+
3778
+ ### pseudoHTMLDocument.body : <code>PseudoHTMLElement</code>
3779
+ Create document body element
3313
3780
 
3781
+ **Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3314
3782
  <a name="NodeService+acceptsChildren"></a>
3315
3783
 
3316
- ### linkedNode.acceptsChildren ⇒ <code>boolean</code>
3784
+ ### pseudoHTMLDocument.acceptsChildren ⇒ <code>boolean</code>
3317
3785
  Whether this kind of node can have children (text, comments and attributes cannot).
3318
3786
 
3319
- **Kind**: instance property of [<code>LinkedNode</code>](#LinkedNode)
3787
+ **Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3320
3788
  **Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
3789
+ <a name="PseudoHTMLDocument+cloneShallow"></a>
3790
+
3791
+ ### pseudoHTMLDocument.cloneShallow() ⇒ [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3792
+ A copy of this document with none of its html/head/body (cloneNode, from the inherited cloneShallow hook, fills
3793
+ them back in, deep copies own document's, empty otherwise - see cloneNode).
3794
+
3795
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3796
+ **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
3797
+ <a name="PseudoHTMLDocument+cloneNode"></a>
3798
+
3799
+ ### pseudoHTMLDocument.cloneNode([deep]) ⇒ [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3800
+ Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in
3801
+ the document (a shallow one is an empty document).
3802
+
3803
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3804
+ **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
3805
+
3806
+ | Param | Type | Default | Description |
3807
+ | --- | --- | --- | --- |
3808
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy everything in the document as well |
3809
+
3810
+ <a name="DocumentService+getElementById"></a>
3811
+
3812
+ ### pseudoHTMLDocument.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
3813
+ The first element, in tree order, whose id matches the given value, or null when there is none.
3814
+
3815
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3816
+ **Overrides**: [<code>getElementById</code>](#DocumentService+getElementById)
3817
+
3818
+ | Param | Type |
3819
+ | --- | --- |
3820
+ | id | <code>string</code> |
3821
+
3822
+ <a name="DocumentService+createElement"></a>
3823
+
3824
+ ### pseudoHTMLDocument.createElement([tagName]) ⇒ <code>PseudoElement</code>
3825
+ Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
3826
+
3827
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3828
+ **Overrides**: [<code>createElement</code>](#DocumentService+createElement)
3829
+
3830
+ | Param | Type | Default | Description |
3831
+ | --- | --- | --- | --- |
3832
+ | [tagName] | <code>string</code> | <code>&quot;&#x27;div&#x27;&quot;</code> | The type of element to create |
3833
+
3834
+ <a name="DocumentService+createTextNode"></a>
3835
+
3836
+ ### pseudoHTMLDocument.createTextNode([data]) ⇒ [<code>TextService</code>](#TextService)
3837
+ Make a text node which belongs to this document.
3838
+
3839
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3840
+ **Overrides**: [<code>createTextNode</code>](#DocumentService+createTextNode)
3841
+
3842
+ | Param | Type | Default | Description |
3843
+ | --- | --- | --- | --- |
3844
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The text |
3845
+
3846
+ <a name="DocumentService+createComment"></a>
3847
+
3848
+ ### pseudoHTMLDocument.createComment([data]) ⇒ [<code>CommentService</code>](#CommentService)
3849
+ Make a comment which belongs to this document.
3850
+
3851
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3852
+ **Overrides**: [<code>createComment</code>](#DocumentService+createComment)
3853
+
3854
+ | Param | Type | Default | Description |
3855
+ | --- | --- | --- | --- |
3856
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The comment |
3857
+
3858
+ <a name="DocumentService+createDocumentFragment"></a>
3859
+
3860
+ ### pseudoHTMLDocument.createDocumentFragment() ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3861
+ Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
3862
+ then inserted in one go.
3863
+
3864
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3865
+ **Overrides**: [<code>createDocumentFragment</code>](#DocumentService+createDocumentFragment)
3321
3866
  <a name="NodeService+appendChild"></a>
3322
3867
 
3323
- ### linkedNode.appendChild(childNode) ⇒ <code>PseudoNode</code>
3868
+ ### pseudoHTMLDocument.appendChild(childNode) ⇒ <code>PseudoNode</code>
3324
3869
  Add a node as the last child of this node (a node which is already in a tree is moved).
3325
3870
 
3326
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3871
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3327
3872
  **Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
3328
3873
  **Returns**: <code>PseudoNode</code> - The added node
3329
3874
 
@@ -3331,21 +3876,13 @@ Add a node as the last child of this node (a node which is already in a tree is
3331
3876
  | --- | --- | --- |
3332
3877
  | childNode | <code>PseudoNode</code> | The node to add |
3333
3878
 
3334
- <a name="NodeService+cloneShallow"></a>
3335
-
3336
- ### linkedNode.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
3337
- Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
3338
- Kinds of node which are made with arguments override this to give them.
3339
-
3340
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3341
- **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
3342
3879
  <a name="NodeService+equalsShallow"></a>
3343
3880
 
3344
- ### linkedNode.equalsShallow(other) ⇒ <code>boolean</code>
3881
+ ### pseudoHTMLDocument.equalsShallow(other) ⇒ <code>boolean</code>
3345
3882
  Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
3346
3883
  afterwards. Kinds of node with more to compare (an element has attributes) override this.
3347
3884
 
3348
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3885
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3349
3886
  **Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
3350
3887
 
3351
3888
  | Param | Type | Description |
@@ -3354,10 +3891,10 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
3354
3891
 
3355
3892
  <a name="NodeService+append"></a>
3356
3893
 
3357
- ### linkedNode.append(...nodes)
3894
+ ### pseudoHTMLDocument.append(...nodes)
3358
3895
  Add nodes (strings become text nodes) as the last children of this node, in the order given.
3359
3896
 
3360
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3897
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3361
3898
  **Overrides**: [<code>append</code>](#NodeService+append)
3362
3899
  **Throws**:
3363
3900
 
@@ -3370,10 +3907,10 @@ Add nodes (strings become text nodes) as the last children of this node, in the
3370
3907
 
3371
3908
  <a name="NodeService+prepend"></a>
3372
3909
 
3373
- ### linkedNode.prepend(...nodes)
3910
+ ### pseudoHTMLDocument.prepend(...nodes)
3374
3911
  Add nodes (strings become text nodes) as the first children of this node, in the order given.
3375
3912
 
3376
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3913
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3377
3914
  **Overrides**: [<code>prepend</code>](#NodeService+prepend)
3378
3915
  **Throws**:
3379
3916
 
@@ -3386,10 +3923,10 @@ Add nodes (strings become text nodes) as the first children of this node, in the
3386
3923
 
3387
3924
  <a name="NodeService+replaceChildren"></a>
3388
3925
 
3389
- ### linkedNode.replaceChildren(...nodes)
3926
+ ### pseudoHTMLDocument.replaceChildren(...nodes)
3390
3927
  Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
3391
3928
 
3392
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3929
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3393
3930
  **Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
3394
3931
  **Throws**:
3395
3932
 
@@ -3402,11 +3939,11 @@ Remove every child of this node and put the given nodes (strings become text nod
3402
3939
 
3403
3940
  <a name="NodeService+before"></a>
3404
3941
 
3405
- ### linkedNode.before(...nodes)
3942
+ ### pseudoHTMLDocument.before(...nodes)
3406
3943
  Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
3407
3944
  no parent.
3408
3945
 
3409
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3946
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3410
3947
  **Overrides**: [<code>before</code>](#NodeService+before)
3411
3948
 
3412
3949
  | Param | Type | Description |
@@ -3415,11 +3952,11 @@ no parent.
3415
3952
 
3416
3953
  <a name="NodeService+after"></a>
3417
3954
 
3418
- ### linkedNode.after(...nodes)
3955
+ ### pseudoHTMLDocument.after(...nodes)
3419
3956
  Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
3420
3957
  parent.
3421
3958
 
3422
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3959
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3423
3960
  **Overrides**: [<code>after</code>](#NodeService+after)
3424
3961
 
3425
3962
  | Param | Type | Description |
@@ -3428,11 +3965,11 @@ parent.
3428
3965
 
3429
3966
  <a name="NodeService+replaceWith"></a>
3430
3967
 
3431
- ### linkedNode.replaceWith(...nodes)
3968
+ ### pseudoHTMLDocument.replaceWith(...nodes)
3432
3969
  Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
3433
3970
  when this node has no parent.
3434
3971
 
3435
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3972
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3436
3973
  **Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
3437
3974
 
3438
3975
  | Param | Type | Description |
@@ -3441,59 +3978,95 @@ when this node has no parent.
3441
3978
 
3442
3979
  <a name="NodeService+remove"></a>
3443
3980
 
3444
- ### linkedNode.remove()
3981
+ ### pseudoHTMLDocument.remove()
3445
3982
  Remove this node from its parent. Does nothing when it has no parent.
3446
3983
 
3447
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3984
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3448
3985
  **Overrides**: [<code>remove</code>](#NodeService+remove)
3449
3986
  <a name="NodeService+toChildNode"></a>
3450
3987
 
3451
- ### linkedNode.toChildNode(value) ⇒ <code>PseudoNode</code>
3988
+ ### pseudoHTMLDocument.toChildNode(value) ⇒ <code>PseudoNode</code>
3452
3989
  Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
3453
3990
  becomes a text node belonging to this node's document, anything else is returned as it is.
3454
3991
 
3455
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3992
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3456
3993
  **Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
3457
3994
 
3458
3995
  | Param | Type | Description |
3459
3996
  | --- | --- | --- |
3460
3997
  | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
3461
3998
 
3999
+ <a name="NodeService+getElementsByTagName"></a>
4000
+
4001
+ ### pseudoHTMLDocument.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
4002
+ Every element below this node with the given tag name (or every element when tagName is *), live.
4003
+
4004
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
4005
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
4006
+
4007
+ | Param | Type |
4008
+ | --- | --- |
4009
+ | tagName | <code>string</code> |
4010
+
4011
+ <a name="NodeService+getElementsByClassName"></a>
4012
+
4013
+ ### pseudoHTMLDocument.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
4014
+ Every element below this node which has all of the given (space separated) classes, live.
4015
+
4016
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
4017
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
4018
+
4019
+ | Param | Type |
4020
+ | --- | --- |
4021
+ | className | <code>string</code> |
4022
+
4023
+ <a name="NodeService+querySelector"></a>
4024
+
4025
+ ### pseudoHTMLDocument.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
4026
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
4027
+
4028
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
4029
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
4030
+
4031
+ | Param | Type | Description |
4032
+ | --- | --- | --- |
4033
+ | selectors | <code>string</code> | A CSS selector |
4034
+
4035
+ <a name="NodeService+querySelectorAll"></a>
4036
+
4037
+ ### pseudoHTMLDocument.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
4038
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
4039
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
4040
+
4041
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
4042
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
4043
+
4044
+ | Param | Type | Description |
4045
+ | --- | --- | --- |
4046
+ | selectors | <code>string</code> | A CSS selector |
4047
+
3462
4048
  <a name="NodeService+childInserted"></a>
3463
4049
 
3464
- ### linkedNode.childInserted(child)
4050
+ ### pseudoHTMLDocument.childInserted(child)
3465
4051
  Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
3466
4052
  (for example elements applying default events) can do so.
3467
4053
 
3468
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4054
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3469
4055
  **Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
3470
4056
 
3471
4057
  | Param | Type | Description |
3472
4058
  | --- | --- | --- |
3473
4059
  | child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
3474
4060
 
3475
- <a name="NodeService+cloneNode"></a>
3476
-
3477
- ### linkedNode.cloneNode([deep]) ⇒ <code>PseudoNode</code>
3478
- Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
3479
- too, all the way down.
3480
-
3481
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3482
- **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
3483
-
3484
- | Param | Type | Default | Description |
3485
- | --- | --- | --- | --- |
3486
- | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
3487
-
3488
4061
  <a name="NodeService+compareDocumentPosition"></a>
3489
4062
 
3490
- ### linkedNode.compareDocumentPosition(otherNode) ⇒ <code>number</code>
4063
+ ### pseudoHTMLDocument.compareDocumentPosition(otherNode) ⇒ <code>number</code>
3491
4064
  Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
3492
4065
  itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
3493
4066
  CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
3494
4067
  otherwise PRECEDING or FOLLOWING by their order in the tree.
3495
4068
 
3496
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4069
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3497
4070
  **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
3498
4071
 
3499
4072
  | Param | Type | Description |
@@ -3502,10 +4075,10 @@ otherwise PRECEDING or FOLLOWING by their order in the tree.
3502
4075
 
3503
4076
  <a name="NodeService+contains"></a>
3504
4077
 
3505
- ### linkedNode.contains(otherNode) ⇒ <code>boolean</code>
4078
+ ### pseudoHTMLDocument.contains(otherNode) ⇒ <code>boolean</code>
3506
4079
  Check whether a node is this node or one of its descendants.
3507
4080
 
3508
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4081
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3509
4082
  **Overrides**: [<code>contains</code>](#NodeService+contains)
3510
4083
 
3511
4084
  | Param | Type | Description |
@@ -3514,11 +4087,11 @@ Check whether a node is this node or one of its descendants.
3514
4087
 
3515
4088
  <a name="NodeService+insertBefore"></a>
3516
4089
 
3517
- ### linkedNode.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
4090
+ ### pseudoHTMLDocument.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
3518
4091
  Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
3519
4092
  already in a tree is moved, and the children of a document fragment are moved in order.
3520
4093
 
3521
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4094
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3522
4095
  **Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
3523
4096
  **Returns**: <code>PseudoNode</code> - The inserted node
3524
4097
  **Throws**:
@@ -3533,11 +4106,11 @@ already in a tree is moved, and the children of a document fragment are moved in
3533
4106
 
3534
4107
  <a name="NodeService+isEqualNode"></a>
3535
4108
 
3536
- ### linkedNode.isEqualNode(otherNode) ⇒ <code>boolean</code>
4109
+ ### pseudoHTMLDocument.isEqualNode(otherNode) ⇒ <code>boolean</code>
3537
4110
  Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
3538
4111
  needs the same attributes), and children which are equal in the same order.
3539
4112
 
3540
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4113
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3541
4114
  **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
3542
4115
 
3543
4116
  | Param | Type | Description |
@@ -3546,17 +4119,17 @@ needs the same attributes), and children which are equal in the same order.
3546
4119
 
3547
4120
  <a name="NodeService+normalize"></a>
3548
4121
 
3549
- ### linkedNode.normalize()
4122
+ ### pseudoHTMLDocument.normalize()
3550
4123
  Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
3551
4124
 
3552
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4125
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3553
4126
  **Overrides**: [<code>normalize</code>](#NodeService+normalize)
3554
4127
  <a name="NodeService+removeChild"></a>
3555
4128
 
3556
- ### linkedNode.removeChild(childElement) ⇒ <code>PseudoNode</code>
4129
+ ### pseudoHTMLDocument.removeChild(childElement) ⇒ <code>PseudoNode</code>
3557
4130
  Remove a child from this node, it no longer has a parent or siblings afterwards.
3558
4131
 
3559
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4132
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3560
4133
  **Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
3561
4134
  **Returns**: <code>PseudoNode</code> - The removed node
3562
4135
  **Throws**:
@@ -3570,10 +4143,10 @@ Remove a child from this node, it no longer has a parent or siblings afterwards.
3570
4143
 
3571
4144
  <a name="NodeService+replaceChild"></a>
3572
4145
 
3573
- ### linkedNode.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
4146
+ ### pseudoHTMLDocument.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
3574
4147
  Replace a child of this node with another node (which is moved if it is already in a tree).
3575
4148
 
3576
- **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
4149
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3577
4150
  **Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
3578
4151
  **Returns**: <code>PseudoNode</code> - The replaced node
3579
4152
  **Throws**:
@@ -3586,134 +4159,6 @@ Replace a child of this node with another node (which is moved if it is already
3586
4159
  | newChild | <code>PseudoNode</code> | The node which takes the place |
3587
4160
  | oldChild | <code>PseudoNode</code> | The child of this node to replace |
3588
4161
 
3589
- <a name="PseudoNodeList"></a>
3590
-
3591
- ## PseudoNodeList ⇐ <code>LinkedTreeList</code>
3592
- A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
3593
- the linkers that hold them.
3594
-
3595
- **Kind**: global class
3596
- **Extends**: <code>LinkedTreeList</code>
3597
-
3598
- * [PseudoNodeList](#PseudoNodeList) ⇐ <code>LinkedTreeList</code>
3599
- * [.entries()](#PseudoNodeList+entries) ⇒ <code>Iterator</code>
3600
- * [.keys()](#PseudoNodeList+keys) ⇒ <code>Iterator</code>
3601
- * [.values()](#PseudoNodeList+values) ⇒ <code>Iterator</code>
3602
-
3603
- <a name="PseudoNodeList+entries"></a>
3604
-
3605
- ### pseudoNodeList.entries() ⇒ <code>Iterator</code>
3606
- Iterate over [index, node] pairs.
3607
-
3608
- **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3609
- <a name="PseudoNodeList+keys"></a>
3610
-
3611
- ### pseudoNodeList.keys() ⇒ <code>Iterator</code>
3612
- Iterate over the indexes.
3613
-
3614
- **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3615
- <a name="PseudoNodeList+values"></a>
3616
-
3617
- ### pseudoNodeList.values() ⇒ <code>Iterator</code>
3618
- Iterate over the nodes.
3619
-
3620
- **Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
3621
- <a name="PseudoHTMLDocument"></a>
3622
-
3623
- ## PseudoHTMLDocument ⇐ <code>PseudoHTMLElement</code>
3624
- Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
3625
-
3626
- **Kind**: global class
3627
- **Extends**: <code>PseudoHTMLElement</code>
3628
- **Author**: Joshua Heagle <joshuaheagle@gmail.com>
3629
- **Properties**
3630
-
3631
- | Name | Type | Description |
3632
- | --- | --- | --- |
3633
- | head | <code>PseudoHTMLElement</code> | A reference to the Head child element |
3634
- | body | <code>PseudoHTMLElement</code> | A reference to the Body child element |
3635
- | createElement | <code>function</code> | Generate a new PseudoHTMLElement (which is not in the document until it is appended) |
3636
-
3637
-
3638
- * [PseudoHTMLDocument](#PseudoHTMLDocument) ⇐ <code>PseudoHTMLElement</code>
3639
- * [new PseudoHTMLDocument()](#new_PseudoHTMLDocument_new)
3640
- * [.head](#PseudoHTMLDocument+head) : <code>PseudoHTMLElement</code>
3641
- * [.body](#PseudoHTMLDocument+body) : <code>PseudoHTMLElement</code>
3642
- * [.createElement(tagName)](#PseudoHTMLDocument+createElement) ⇒ <code>PseudoHTMLElement</code>
3643
- * [.createTextNode([data])](#PseudoHTMLDocument+createTextNode) ⇒ [<code>TextService</code>](#TextService)
3644
- * [.createComment([data])](#PseudoHTMLDocument+createComment) ⇒ [<code>CommentService</code>](#CommentService)
3645
- * [.createDocumentFragment()](#PseudoHTMLDocument+createDocumentFragment) ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3646
- * [.cloneNode([deep])](#PseudoHTMLDocument+cloneNode) ⇒ <code>PseudoNode</code>
3647
-
3648
- <a name="new_PseudoHTMLDocument_new"></a>
3649
-
3650
- ### new PseudoHTMLDocument()
3651
- The root HTML element is acts as the parent to all HTML elements in the document.
3652
-
3653
- <a name="PseudoHTMLDocument+head"></a>
3654
-
3655
- ### pseudoHTMLDocument.head : <code>PseudoHTMLElement</code>
3656
- Create document head element
3657
-
3658
- **Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3659
- <a name="PseudoHTMLDocument+body"></a>
3660
-
3661
- ### pseudoHTMLDocument.body : <code>PseudoHTMLElement</code>
3662
- Create document body element
3663
-
3664
- **Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3665
- <a name="PseudoHTMLDocument+createElement"></a>
3666
-
3667
- ### pseudoHTMLDocument.createElement(tagName) ⇒ <code>PseudoHTMLElement</code>
3668
- Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
3669
-
3670
- **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3671
-
3672
- | Param | Type | Default | Description |
3673
- | --- | --- | --- | --- |
3674
- | tagName | <code>string</code> | <code>&quot;div&quot;</code> | Tag Name is a string representing the type of Dom element this represents |
3675
-
3676
- <a name="PseudoHTMLDocument+createTextNode"></a>
3677
-
3678
- ### pseudoHTMLDocument.createTextNode([data]) ⇒ [<code>TextService</code>](#TextService)
3679
- Make a text node which belongs to this document.
3680
-
3681
- **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3682
-
3683
- | Param | Type | Default | Description |
3684
- | --- | --- | --- | --- |
3685
- | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The text |
3686
-
3687
- <a name="PseudoHTMLDocument+createComment"></a>
3688
-
3689
- ### pseudoHTMLDocument.createComment([data]) ⇒ [<code>CommentService</code>](#CommentService)
3690
- Make a comment which belongs to this document.
3691
-
3692
- **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3693
-
3694
- | Param | Type | Default | Description |
3695
- | --- | --- | --- | --- |
3696
- | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The comment |
3697
-
3698
- <a name="PseudoHTMLDocument+createDocumentFragment"></a>
3699
-
3700
- ### pseudoHTMLDocument.createDocumentFragment() ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
3701
- Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
3702
- then inserted in one go.
3703
-
3704
- **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3705
- <a name="PseudoHTMLDocument+cloneNode"></a>
3706
-
3707
- ### pseudoHTMLDocument.cloneNode([deep]) ⇒ <code>PseudoNode</code>
3708
- Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in the
3709
- document (a shallow one is an empty document).
3710
-
3711
- **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
3712
-
3713
- | Param | Type | Default | Description |
3714
- | --- | --- | --- | --- |
3715
- | [deep] | <code>boolean</code> | <code>false</code> | Copy everything in the document as well |
3716
-
3717
4162
  <a name="PseudoEventListener"></a>
3718
4163
 
3719
4164
  ## PseudoEventListener
@@ -3856,10 +4301,6 @@ The values follow the UI Events, HTML, Pointer Events, Clipboard, Drag and Drop,
3856
4301
  ## focused
3857
4302
  The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.
3858
4303
 
3859
- **Kind**: global constant
3860
- <a name="HTMLElementService_1"></a>
3861
-
3862
- ## HTMLElementService\_1 : <code>PseudoHTMLElement</code>
3863
4304
  **Kind**: global constant
3864
4305
  <a name="modifierKeys"></a>
3865
4306
 
@@ -3945,14 +4386,6 @@ Create a PseudoNodeList, optionally starting from an existing chain of linkers.
3945
4386
  | --- | --- | --- |
3946
4387
  | [innerList] | <code>TreeLinker</code> \| <code>null</code> | <code></code> |
3947
4388
 
3948
- <a name="generateNode"></a>
3949
-
3950
- ## generateNode() ⇒ <code>function</code>
3951
- Create a TreeLinker class whose linkers each store a node (a LinkedNode) as their data, this can be used to build a
3952
- tree (or list) of nodes from plain values.
3953
-
3954
- **Kind**: global function
3955
- **Returns**: <code>function</code> - The NodeFactory class (a TreeLinker) to use as the linker class
3956
4389
  <a name="generateDocument"></a>
3957
4390
 
3958
4391
  ## generateDocument(root, context) ⇒ <code>Window</code> \| <code>PseudoEventTarget</code>
@@ -3998,6 +4431,18 @@ Create an instance of HTMLElement if not available
3998
4431
  Define document when not available
3999
4432
 
4000
4433
  **Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
4434
+ <a name="nearestElementSibling"></a>
4435
+
4436
+ ## nearestElementSibling(node, direction) ⇒ <code>\*</code> \| <code>null</code>
4437
+ Walk up from a node (not including it) to find the nearest element, in the given direction.
4438
+
4439
+ **Kind**: global function
4440
+
4441
+ | Param | Type | Description |
4442
+ | --- | --- | --- |
4443
+ | node | <code>\*</code> | The node to start from |
4444
+ | direction | <code>&#x27;nextSibling&#x27;</code> \| <code>&#x27;previousSibling&#x27;</code> | Which sibling reference to follow |
4445
+
4001
4446
  <a name="createEvent"></a>
4002
4447
 
4003
4448
  ## createEvent(type, [init], [options]) ⇒ [<code>EventService</code>](#EventService)