pseudo-dom 0.5.1 → 0.7.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 (122) hide show
  1. package/README.md +1495 -119
  2. package/browser/pseudo-dom.js +3539 -482
  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 +67 -67
  7. package/dist/classes/PseudoHTMLDocument.js +144 -144
  8. package/dist/classes/PseudoNodeList.d.ts +34 -34
  9. package/dist/classes/PseudoNodeList.js +71 -71
  10. package/dist/classes.d.ts +20 -20
  11. package/dist/classes.js +31 -31
  12. package/dist/factories/createEvent.d.ts +28 -28
  13. package/dist/factories/createEvent.js +56 -56
  14. package/dist/factories/cssSelectAdapter.d.ts +23 -0
  15. package/dist/factories/cssSelectAdapter.js +87 -0
  16. package/dist/factories/cssSelectAdapter.min.js +1 -0
  17. package/dist/factories/eventDefaults.d.ts +31 -31
  18. package/dist/factories/eventDefaults.js +105 -105
  19. package/dist/factories/generateDocument.d.ts +11 -11
  20. package/dist/factories/generateDocument.js +65 -65
  21. package/dist/factories/generateNode.d.ts +32 -32
  22. package/dist/factories/generateNode.js +85 -85
  23. package/dist/factories/generateNodeList.d.ts +9 -9
  24. package/dist/factories/generateNodeList.js +13 -13
  25. package/dist/factories/query.d.ts +33 -0
  26. package/dist/factories/query.js +66 -0
  27. package/dist/factories/query.min.js +1 -0
  28. package/dist/factories.d.ts +11 -11
  29. package/dist/factories.js +27 -27
  30. package/dist/functions/activeElement.d.ts +14 -14
  31. package/dist/functions/activeElement.js +33 -33
  32. package/dist/functions/getParentNodes.d.ts +11 -11
  33. package/dist/functions/getParentNodes.js +22 -22
  34. package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
  35. package/dist/functions/getParentNodesFromAttribute.js +29 -29
  36. package/dist/functions/modifierState.d.ts +29 -29
  37. package/dist/functions/modifierState.js +41 -41
  38. package/dist/functions.d.ts +5 -5
  39. package/dist/functions.js +23 -23
  40. package/dist/interfaces/PseudoAnimation.d.ts +3 -3
  41. package/dist/interfaces/PseudoAnimation.js +5 -5
  42. package/dist/interfaces/PseudoAttr.d.ts +11 -11
  43. package/dist/interfaces/PseudoAttr.js +5 -5
  44. package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
  45. package/dist/interfaces/PseudoDOMTokenList.js +5 -5
  46. package/dist/interfaces/PseudoDocument.d.ts +7 -0
  47. package/dist/interfaces/PseudoDocument.js +5 -5
  48. package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -3
  49. package/dist/interfaces/PseudoDocumentFragment.js +5 -5
  50. package/dist/interfaces/PseudoElement.d.ts +48 -24
  51. package/dist/interfaces/PseudoElement.js +5 -5
  52. package/dist/interfaces/PseudoEvent.d.ts +79 -79
  53. package/dist/interfaces/PseudoEvent.js +10 -10
  54. package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
  55. package/dist/interfaces/PseudoEventTarget.js +5 -5
  56. package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -2
  57. package/dist/interfaces/PseudoHTMLCollection.js +5 -5
  58. package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
  59. package/dist/interfaces/PseudoHTMLElement.js +5 -5
  60. package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
  61. package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
  62. package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
  63. package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
  64. package/dist/interfaces/PseudoNode.d.ts +179 -179
  65. package/dist/interfaces/PseudoNode.js +5 -5
  66. package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
  67. package/dist/interfaces/PseudoShadowRoot.js +5 -5
  68. package/dist/main.d.ts +63 -63
  69. package/dist/main.js +155 -155
  70. package/dist/services/AnimationService.d.ts +4 -4
  71. package/dist/services/AnimationService.js +16 -16
  72. package/dist/services/AttrService.d.ts +37 -37
  73. package/dist/services/AttrService.js +81 -81
  74. package/dist/services/CommentService.d.ts +1 -1
  75. package/dist/services/CommentService.js +13 -13
  76. package/dist/services/CustomEventService.d.ts +37 -37
  77. package/dist/services/CustomEventService.js +35 -35
  78. package/dist/services/DOMTokenListService.d.ts +33 -33
  79. package/dist/services/DOMTokenListService.js +117 -117
  80. package/dist/services/DocumentFragmentService.d.ts +13 -13
  81. package/dist/services/DocumentFragmentService.js +24 -24
  82. package/dist/services/DocumentService.d.ts +7 -0
  83. package/dist/services/DocumentService.js +23 -0
  84. package/dist/services/DocumentService.min.js +1 -1
  85. package/dist/services/ElementService.d.ts +77 -1
  86. package/dist/services/ElementService.js +143 -0
  87. package/dist/services/ElementService.min.js +1 -1
  88. package/dist/services/EventService.d.ts +120 -120
  89. package/dist/services/EventService.js +250 -250
  90. package/dist/services/EventTargetService.d.ts +84 -84
  91. package/dist/services/EventTargetService.js +232 -232
  92. package/dist/services/FocusEventService.d.ts +32 -32
  93. package/dist/services/FocusEventService.js +35 -35
  94. package/dist/services/HTMLCollectionService.d.ts +51 -0
  95. package/dist/services/HTMLCollectionService.js +85 -1
  96. package/dist/services/HTMLCollectionService.min.js +1 -1
  97. package/dist/services/HTMLElementService.d.ts +57 -57
  98. package/dist/services/HTMLElementService.js +163 -163
  99. package/dist/services/HTMLSlotElementService.d.ts +4 -4
  100. package/dist/services/HTMLSlotElementService.js +9 -9
  101. package/dist/services/InputEventService.d.ts +41 -41
  102. package/dist/services/InputEventService.js +47 -47
  103. package/dist/services/KeyboardEventService.d.ts +70 -70
  104. package/dist/services/KeyboardEventService.js +86 -86
  105. package/dist/services/MouseEventService.d.ts +80 -80
  106. package/dist/services/MouseEventService.js +108 -108
  107. package/dist/services/NamedNodeMapService.d.ts +23 -23
  108. package/dist/services/NamedNodeMapService.js +77 -77
  109. package/dist/services/NodeService.d.ts +75 -1
  110. package/dist/services/NodeService.js +145 -7
  111. package/dist/services/NodeService.min.js +1 -1
  112. package/dist/services/PointerEventService.d.ts +51 -51
  113. package/dist/services/PointerEventService.js +67 -67
  114. package/dist/services/ShadowRootService.d.ts +4 -4
  115. package/dist/services/ShadowRootService.js +9 -9
  116. package/dist/services/TextService.d.ts +1 -1
  117. package/dist/services/TextService.js +13 -13
  118. package/dist/services/UIEventService.d.ts +43 -43
  119. package/dist/services/UIEventService.js +42 -42
  120. package/dist/simulate.d.ts +32 -32
  121. package/dist/simulate.js +115 -115
  122. package/package.json +3 -2
package/README.md CHANGED
@@ -38,9 +38,22 @@ nodes. There are text and comment nodes (`PseudoText`, `PseudoComment`) and `tex
38
38
  of everything below, and setting it replaces the children with a text node); the document makes them with
39
39
  `createTextNode`, `createComment` and `createDocumentFragment`.
40
40
 
41
- Not implemented yet (these throw a "not implemented" error or are missing): `querySelector` /
42
- `querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the Element and Document APIs. The API
43
- will change before 1.0.
41
+ Elements can be walked and changed like the DOM: \`children\` is a live \`HTMLCollection\` of just the element
42
+ children, \`childElementCount\`, \`firstElementChild\` / \`lastElementChild\` and \`nextElementSibling\` /
43
+ \`previousElementSibling\` skip text and comment nodes. \`append\` / \`prepend\` / \`before\` / \`after\` / \`remove\` /
44
+ \`replaceWith\` / \`replaceChildren\` accept nodes or strings (a string becomes a text node) and move a node already in
45
+ a tree rather than duplicating it; \`insertAdjacentElement\` / \`insertAdjacentText\` insert at beforebegin / afterbegin
46
+ / beforeend / afterend (\`insertAdjacentHTML\` is not implemented, no HTML parsing yet).
47
+
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 \`DocumentService\` only,
53
+ matching the real DOM.
54
+
55
+ Not implemented yet (these throw a "not implemented" error or are missing): \`getElementsByTagNameNS\`, \`innerHTML\` /
56
+ \`outerHTML\` parsing, and most of the rest of the Element and Document APIs. The API will change before 1.0.
44
57
  ## Modules
45
58
 
46
59
  <dl>
@@ -86,6 +99,10 @@ interface (the mouse, the keyboard, focus and input).</p>
86
99
  <dt><a href="#HTMLElementService">HTMLElementService</a> ⇐ <code>PseudoElement</code></dt>
87
100
  <dd><p>Simulate the behaviour of the HTMLElement Class when there is no DOM available.</p>
88
101
  </dd>
102
+ <dt><a href="#HTMLCollectionService">HTMLCollectionService</a></dt>
103
+ <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
104
+ element descendants, recomputed each time it is used rather than kept in sync as they change.</p>
105
+ </dd>
89
106
  <dt><a href="#FocusEventService">FocusEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
90
107
  <dd><p>Simulate the behaviour of the FocusEvent Class when there is no DOM available.</p>
91
108
  </dd>
@@ -189,6 +206,9 @@ tree (or list) of nodes from plain values.</p>
189
206
  <dd><p>Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
190
207
  context.</p>
191
208
  </dd>
209
+ <dt><a href="#nearestElementSibling">nearestElementSibling(node, direction)</a> ⇒ <code>*</code> | <code>null</code></dt>
210
+ <dd><p>Walk up from a node (not including it) to find the nearest element, in the given direction.</p>
211
+ </dd>
192
212
  <dt><a href="#createEvent">createEvent(type, [init], [options])</a> ⇒ <code><a href="#EventService">EventService</a></code></dt>
193
213
  <dd><p>Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
194
214
  By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
@@ -437,6 +457,18 @@ Simulate the behaviour of the Node Class when there is no DOM available.
437
457
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
438
458
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
439
459
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
460
+ * [.append(...nodes)](#NodeService+append)
461
+ * [.prepend(...nodes)](#NodeService+prepend)
462
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
463
+ * [.before(...nodes)](#NodeService+before)
464
+ * [.after(...nodes)](#NodeService+after)
465
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
466
+ * [.remove()](#NodeService+remove)
467
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
468
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
469
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
470
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
471
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
440
472
  * [.childInserted(child)](#NodeService+childInserted)
441
473
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
442
474
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -484,6 +516,150 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
484
516
  | --- | --- | --- |
485
517
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
486
518
 
519
+ <a name="NodeService+append"></a>
520
+
521
+ ### nodeService.append(...nodes)
522
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
523
+
524
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
525
+ **Throws**:
526
+
527
+ - <code>Error</code> When this kind of node cannot have children
528
+
529
+
530
+ | Param | Type | Description |
531
+ | --- | --- | --- |
532
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
533
+
534
+ <a name="NodeService+prepend"></a>
535
+
536
+ ### nodeService.prepend(...nodes)
537
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
538
+
539
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
540
+ **Throws**:
541
+
542
+ - <code>Error</code> When this kind of node cannot have children
543
+
544
+
545
+ | Param | Type | Description |
546
+ | --- | --- | --- |
547
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
548
+
549
+ <a name="NodeService+replaceChildren"></a>
550
+
551
+ ### nodeService.replaceChildren(...nodes)
552
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
553
+
554
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
555
+ **Throws**:
556
+
557
+ - <code>Error</code> When this kind of node cannot have children
558
+
559
+
560
+ | Param | Type | Description |
561
+ | --- | --- | --- |
562
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
563
+
564
+ <a name="NodeService+before"></a>
565
+
566
+ ### nodeService.before(...nodes)
567
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
568
+ no parent.
569
+
570
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
571
+
572
+ | Param | Type | Description |
573
+ | --- | --- | --- |
574
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
575
+
576
+ <a name="NodeService+after"></a>
577
+
578
+ ### nodeService.after(...nodes)
579
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
580
+ parent.
581
+
582
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
583
+
584
+ | Param | Type | Description |
585
+ | --- | --- | --- |
586
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
587
+
588
+ <a name="NodeService+replaceWith"></a>
589
+
590
+ ### nodeService.replaceWith(...nodes)
591
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
592
+ when this node has no parent.
593
+
594
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
595
+
596
+ | Param | Type | Description |
597
+ | --- | --- | --- |
598
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
599
+
600
+ <a name="NodeService+remove"></a>
601
+
602
+ ### nodeService.remove()
603
+ Remove this node from its parent. Does nothing when it has no parent.
604
+
605
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
606
+ <a name="NodeService+toChildNode"></a>
607
+
608
+ ### nodeService.toChildNode(value) ⇒ <code>PseudoNode</code>
609
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
610
+ becomes a text node belonging to this node's document, anything else is returned as it is.
611
+
612
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
613
+
614
+ | Param | Type | Description |
615
+ | --- | --- | --- |
616
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
617
+
618
+ <a name="NodeService+getElementsByTagName"></a>
619
+
620
+ ### nodeService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
621
+ Every element below this node with the given tag name (or every element when tagName is *), live.
622
+
623
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
624
+
625
+ | Param | Type |
626
+ | --- | --- |
627
+ | tagName | <code>string</code> |
628
+
629
+ <a name="NodeService+getElementsByClassName"></a>
630
+
631
+ ### nodeService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
632
+ Every element below this node which has all of the given (space separated) classes, live.
633
+
634
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
635
+
636
+ | Param | Type |
637
+ | --- | --- |
638
+ | className | <code>string</code> |
639
+
640
+ <a name="NodeService+querySelector"></a>
641
+
642
+ ### nodeService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
643
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
644
+
645
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
646
+
647
+ | Param | Type | Description |
648
+ | --- | --- | --- |
649
+ | selectors | <code>string</code> | A CSS selector |
650
+
651
+ <a name="NodeService+querySelectorAll"></a>
652
+
653
+ ### nodeService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
654
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
655
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
656
+
657
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
658
+
659
+ | Param | Type | Description |
660
+ | --- | --- | --- |
661
+ | selectors | <code>string</code> | A CSS selector |
662
+
487
663
  <a name="NodeService+childInserted"></a>
488
664
 
489
665
  ### nodeService.childInserted(child)
@@ -626,6 +802,18 @@ Simulate the behaviour of the Text Class when there is no DOM available: the tex
626
802
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
627
803
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
628
804
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
805
+ * [.append(...nodes)](#NodeService+append)
806
+ * [.prepend(...nodes)](#NodeService+prepend)
807
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
808
+ * [.before(...nodes)](#NodeService+before)
809
+ * [.after(...nodes)](#NodeService+after)
810
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
811
+ * [.remove()](#NodeService+remove)
812
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
813
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
814
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
815
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
816
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
629
817
  * [.childInserted(child)](#NodeService+childInserted)
630
818
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
631
819
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -702,6 +890,162 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
702
890
  | --- | --- | --- |
703
891
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
704
892
 
893
+ <a name="NodeService+append"></a>
894
+
895
+ ### textService.append(...nodes)
896
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
897
+
898
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
899
+ **Overrides**: [<code>append</code>](#NodeService+append)
900
+ **Throws**:
901
+
902
+ - <code>Error</code> When this kind of node cannot have children
903
+
904
+
905
+ | Param | Type | Description |
906
+ | --- | --- | --- |
907
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
908
+
909
+ <a name="NodeService+prepend"></a>
910
+
911
+ ### textService.prepend(...nodes)
912
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
913
+
914
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
915
+ **Overrides**: [<code>prepend</code>](#NodeService+prepend)
916
+ **Throws**:
917
+
918
+ - <code>Error</code> When this kind of node cannot have children
919
+
920
+
921
+ | Param | Type | Description |
922
+ | --- | --- | --- |
923
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
924
+
925
+ <a name="NodeService+replaceChildren"></a>
926
+
927
+ ### textService.replaceChildren(...nodes)
928
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
929
+
930
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
931
+ **Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
932
+ **Throws**:
933
+
934
+ - <code>Error</code> When this kind of node cannot have children
935
+
936
+
937
+ | Param | Type | Description |
938
+ | --- | --- | --- |
939
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
940
+
941
+ <a name="NodeService+before"></a>
942
+
943
+ ### textService.before(...nodes)
944
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
945
+ no parent.
946
+
947
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
948
+ **Overrides**: [<code>before</code>](#NodeService+before)
949
+
950
+ | Param | Type | Description |
951
+ | --- | --- | --- |
952
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
953
+
954
+ <a name="NodeService+after"></a>
955
+
956
+ ### textService.after(...nodes)
957
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
958
+ parent.
959
+
960
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
961
+ **Overrides**: [<code>after</code>](#NodeService+after)
962
+
963
+ | Param | Type | Description |
964
+ | --- | --- | --- |
965
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
966
+
967
+ <a name="NodeService+replaceWith"></a>
968
+
969
+ ### textService.replaceWith(...nodes)
970
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
971
+ when this node has no parent.
972
+
973
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
974
+ **Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
975
+
976
+ | Param | Type | Description |
977
+ | --- | --- | --- |
978
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
979
+
980
+ <a name="NodeService+remove"></a>
981
+
982
+ ### textService.remove()
983
+ Remove this node from its parent. Does nothing when it has no parent.
984
+
985
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
986
+ **Overrides**: [<code>remove</code>](#NodeService+remove)
987
+ <a name="NodeService+toChildNode"></a>
988
+
989
+ ### textService.toChildNode(value) ⇒ <code>PseudoNode</code>
990
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
991
+ becomes a text node belonging to this node's document, anything else is returned as it is.
992
+
993
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
994
+ **Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
995
+
996
+ | Param | Type | Description |
997
+ | --- | --- | --- |
998
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
999
+
1000
+ <a name="NodeService+getElementsByTagName"></a>
1001
+
1002
+ ### textService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
1003
+ Every element below this node with the given tag name (or every element when tagName is *), live.
1004
+
1005
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1006
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
1007
+
1008
+ | Param | Type |
1009
+ | --- | --- |
1010
+ | tagName | <code>string</code> |
1011
+
1012
+ <a name="NodeService+getElementsByClassName"></a>
1013
+
1014
+ ### textService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
1015
+ Every element below this node which has all of the given (space separated) classes, live.
1016
+
1017
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1018
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
1019
+
1020
+ | Param | Type |
1021
+ | --- | --- |
1022
+ | className | <code>string</code> |
1023
+
1024
+ <a name="NodeService+querySelector"></a>
1025
+
1026
+ ### textService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
1027
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
1028
+
1029
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1030
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
1031
+
1032
+ | Param | Type | Description |
1033
+ | --- | --- | --- |
1034
+ | selectors | <code>string</code> | A CSS selector |
1035
+
1036
+ <a name="NodeService+querySelectorAll"></a>
1037
+
1038
+ ### textService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1039
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
1040
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
1041
+
1042
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
1043
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
1044
+
1045
+ | Param | Type | Description |
1046
+ | --- | --- | --- |
1047
+ | selectors | <code>string</code> | A CSS selector |
1048
+
705
1049
  <a name="NodeService+childInserted"></a>
706
1050
 
707
1051
  ### textService.childInserted(child)
@@ -851,6 +1195,18 @@ Simulate the behaviour of the Comment Class when there is no DOM available: a no
851
1195
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
852
1196
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
853
1197
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1198
+ * [.append(...nodes)](#NodeService+append)
1199
+ * [.prepend(...nodes)](#NodeService+prepend)
1200
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
1201
+ * [.before(...nodes)](#NodeService+before)
1202
+ * [.after(...nodes)](#NodeService+after)
1203
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
1204
+ * [.remove()](#NodeService+remove)
1205
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
1206
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
1207
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
1208
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
1209
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
854
1210
  * [.childInserted(child)](#NodeService+childInserted)
855
1211
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
856
1212
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -910,109 +1266,265 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
910
1266
  | --- | --- | --- |
911
1267
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
912
1268
 
913
- <a name="NodeService+childInserted"></a>
1269
+ <a name="NodeService+append"></a>
914
1270
 
915
- ### commentService.childInserted(child)
916
- Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
917
- (for example elements applying default events) can do so.
1271
+ ### commentService.append(...nodes)
1272
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
918
1273
 
919
1274
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
920
- **Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
1275
+ **Overrides**: [<code>append</code>](#NodeService+append)
1276
+ **Throws**:
1277
+
1278
+ - <code>Error</code> When this kind of node cannot have children
1279
+
921
1280
 
922
1281
  | Param | Type | Description |
923
1282
  | --- | --- | --- |
924
- | child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
1283
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
925
1284
 
926
- <a name="NodeService+cloneNode"></a>
1285
+ <a name="NodeService+prepend"></a>
927
1286
 
928
- ### commentService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
929
- Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
930
- too, all the way down.
1287
+ ### commentService.prepend(...nodes)
1288
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
931
1289
 
932
1290
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
933
- **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
1291
+ **Overrides**: [<code>prepend</code>](#NodeService+prepend)
1292
+ **Throws**:
934
1293
 
935
- | Param | Type | Default | Description |
936
- | --- | --- | --- | --- |
937
- | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1294
+ - <code>Error</code> When this kind of node cannot have children
938
1295
 
939
- <a name="NodeService+compareDocumentPosition"></a>
940
1296
 
941
- ### commentService.compareDocumentPosition(otherNode) <code>number</code>
942
- Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
943
- itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
944
- CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
945
- otherwise PRECEDING or FOLLOWING by their order in the tree.
1297
+ | Param | Type | Description |
1298
+ | --- | --- | --- |
1299
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
1300
+
1301
+ <a name="NodeService+replaceChildren"></a>
1302
+
1303
+ ### commentService.replaceChildren(...nodes)
1304
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
946
1305
 
947
1306
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
948
- **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
1307
+ **Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
1308
+ **Throws**:
1309
+
1310
+ - <code>Error</code> When this kind of node cannot have children
1311
+
949
1312
 
950
1313
  | Param | Type | Description |
951
1314
  | --- | --- | --- |
952
- | otherNode | <code>PseudoNode</code> | The node to locate |
1315
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
953
1316
 
954
- <a name="NodeService+contains"></a>
1317
+ <a name="NodeService+before"></a>
955
1318
 
956
- ### commentService.contains(otherNode) ⇒ <code>boolean</code>
957
- Check whether a node is this node or one of its descendants.
1319
+ ### commentService.before(...nodes)
1320
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
1321
+ no parent.
958
1322
 
959
1323
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
960
- **Overrides**: [<code>contains</code>](#NodeService+contains)
1324
+ **Overrides**: [<code>before</code>](#NodeService+before)
961
1325
 
962
1326
  | Param | Type | Description |
963
1327
  | --- | --- | --- |
964
- | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
1328
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
965
1329
 
966
- <a name="NodeService+insertBefore"></a>
1330
+ <a name="NodeService+after"></a>
967
1331
 
968
- ### commentService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
969
- 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
970
- already in a tree is moved, and the children of a document fragment are moved in order.
1332
+ ### commentService.after(...nodes)
1333
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
1334
+ parent.
971
1335
 
972
1336
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
973
- **Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
974
- **Returns**: <code>PseudoNode</code> - The inserted node
975
- **Throws**:
976
-
977
- - <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
978
-
1337
+ **Overrides**: [<code>after</code>](#NodeService+after)
979
1338
 
980
- | Param | Type | Default | Description |
981
- | --- | --- | --- | --- |
982
- | newNode | <code>PseudoNode</code> | | The node to insert |
983
- | [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
1339
+ | Param | Type | Description |
1340
+ | --- | --- | --- |
1341
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
984
1342
 
985
- <a name="NodeService+isEqualNode"></a>
1343
+ <a name="NodeService+replaceWith"></a>
986
1344
 
987
- ### commentService.isEqualNode(otherNode) ⇒ <code>boolean</code>
988
- Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
989
- needs the same attributes), and children which are equal in the same order.
1345
+ ### commentService.replaceWith(...nodes)
1346
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
1347
+ when this node has no parent.
990
1348
 
991
1349
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
992
- **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
1350
+ **Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
993
1351
 
994
1352
  | Param | Type | Description |
995
1353
  | --- | --- | --- |
996
- | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
1354
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
997
1355
 
998
- <a name="NodeService+normalize"></a>
1356
+ <a name="NodeService+remove"></a>
999
1357
 
1000
- ### commentService.normalize()
1001
- Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
1358
+ ### commentService.remove()
1359
+ Remove this node from its parent. Does nothing when it has no parent.
1002
1360
 
1003
1361
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1004
- **Overrides**: [<code>normalize</code>](#NodeService+normalize)
1005
- <a name="NodeService+removeChild"></a>
1362
+ **Overrides**: [<code>remove</code>](#NodeService+remove)
1363
+ <a name="NodeService+toChildNode"></a>
1006
1364
 
1007
- ### commentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
1008
- Remove a child from this node, it no longer has a parent or siblings afterwards.
1365
+ ### commentService.toChildNode(value) ⇒ <code>PseudoNode</code>
1366
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
1367
+ becomes a text node belonging to this node's document, anything else is returned as it is.
1009
1368
 
1010
1369
  **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1011
- **Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
1012
- **Returns**: <code>PseudoNode</code> - The removed node
1013
- **Throws**:
1014
-
1015
- - <code>Error</code> When the node is not a child of this node
1370
+ **Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
1371
+
1372
+ | Param | Type | Description |
1373
+ | --- | --- | --- |
1374
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
1375
+
1376
+ <a name="NodeService+getElementsByTagName"></a>
1377
+
1378
+ ### commentService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
1379
+ Every element below this node with the given tag name (or every element when tagName is *), live.
1380
+
1381
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1382
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
1383
+
1384
+ | Param | Type |
1385
+ | --- | --- |
1386
+ | tagName | <code>string</code> |
1387
+
1388
+ <a name="NodeService+getElementsByClassName"></a>
1389
+
1390
+ ### commentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
1391
+ Every element below this node which has all of the given (space separated) classes, live.
1392
+
1393
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1394
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
1395
+
1396
+ | Param | Type |
1397
+ | --- | --- |
1398
+ | className | <code>string</code> |
1399
+
1400
+ <a name="NodeService+querySelector"></a>
1401
+
1402
+ ### commentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
1403
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
1404
+
1405
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1406
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
1407
+
1408
+ | Param | Type | Description |
1409
+ | --- | --- | --- |
1410
+ | selectors | <code>string</code> | A CSS selector |
1411
+
1412
+ <a name="NodeService+querySelectorAll"></a>
1413
+
1414
+ ### commentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1415
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
1416
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
1417
+
1418
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1419
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
1420
+
1421
+ | Param | Type | Description |
1422
+ | --- | --- | --- |
1423
+ | selectors | <code>string</code> | A CSS selector |
1424
+
1425
+ <a name="NodeService+childInserted"></a>
1426
+
1427
+ ### commentService.childInserted(child)
1428
+ Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
1429
+ (for example elements applying default events) can do so.
1430
+
1431
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1432
+ **Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
1433
+
1434
+ | Param | Type | Description |
1435
+ | --- | --- | --- |
1436
+ | child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
1437
+
1438
+ <a name="NodeService+cloneNode"></a>
1439
+
1440
+ ### commentService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
1441
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
1442
+ too, all the way down.
1443
+
1444
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1445
+ **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
1446
+
1447
+ | Param | Type | Default | Description |
1448
+ | --- | --- | --- | --- |
1449
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1450
+
1451
+ <a name="NodeService+compareDocumentPosition"></a>
1452
+
1453
+ ### commentService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
1454
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
1455
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
1456
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
1457
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
1458
+
1459
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1460
+ **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
1461
+
1462
+ | Param | Type | Description |
1463
+ | --- | --- | --- |
1464
+ | otherNode | <code>PseudoNode</code> | The node to locate |
1465
+
1466
+ <a name="NodeService+contains"></a>
1467
+
1468
+ ### commentService.contains(otherNode) ⇒ <code>boolean</code>
1469
+ Check whether a node is this node or one of its descendants.
1470
+
1471
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1472
+ **Overrides**: [<code>contains</code>](#NodeService+contains)
1473
+
1474
+ | Param | Type | Description |
1475
+ | --- | --- | --- |
1476
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
1477
+
1478
+ <a name="NodeService+insertBefore"></a>
1479
+
1480
+ ### commentService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
1481
+ 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
1482
+ already in a tree is moved, and the children of a document fragment are moved in order.
1483
+
1484
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1485
+ **Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
1486
+ **Returns**: <code>PseudoNode</code> - The inserted node
1487
+ **Throws**:
1488
+
1489
+ - <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
1490
+
1491
+
1492
+ | Param | Type | Default | Description |
1493
+ | --- | --- | --- | --- |
1494
+ | newNode | <code>PseudoNode</code> | | The node to insert |
1495
+ | [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
1496
+
1497
+ <a name="NodeService+isEqualNode"></a>
1498
+
1499
+ ### commentService.isEqualNode(otherNode) ⇒ <code>boolean</code>
1500
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
1501
+ needs the same attributes), and children which are equal in the same order.
1502
+
1503
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1504
+ **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
1505
+
1506
+ | Param | Type | Description |
1507
+ | --- | --- | --- |
1508
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
1509
+
1510
+ <a name="NodeService+normalize"></a>
1511
+
1512
+ ### commentService.normalize()
1513
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
1514
+
1515
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1516
+ **Overrides**: [<code>normalize</code>](#NodeService+normalize)
1517
+ <a name="NodeService+removeChild"></a>
1518
+
1519
+ ### commentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
1520
+ Remove a child from this node, it no longer has a parent or siblings afterwards.
1521
+
1522
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1523
+ **Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
1524
+ **Returns**: <code>PseudoNode</code> - The removed node
1525
+ **Throws**:
1526
+
1527
+ - <code>Error</code> When the node is not a child of this node
1016
1528
 
1017
1529
 
1018
1530
  | Param | Type | Description |
@@ -1364,6 +1876,66 @@ focus or already has it.
1364
1876
  Take the focus away from the element, when it has it: it gets blur then focusout.
1365
1877
 
1366
1878
  **Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
1879
+ <a name="HTMLCollectionService"></a>
1880
+
1881
+ ## HTMLCollectionService
1882
+ Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of some of a node's
1883
+ element descendants, recomputed each time it is used rather than kept in sync as they change.
1884
+
1885
+ **Kind**: global class
1886
+ **Author**: Joshua Heagle <joshuaheagle@gmail.com>
1887
+
1888
+ * [HTMLCollectionService](#HTMLCollectionService)
1889
+ * [new HTMLCollectionService(owner, [predicate], [deep])](#new_HTMLCollectionService_new)
1890
+ * [.length](#HTMLCollectionService+length) ⇒ <code>number</code>
1891
+ * [.elements()](#HTMLCollectionService+elements) ⇒ <code>Array.&lt;PseudoNode&gt;</code>
1892
+ * [.item(index)](#HTMLCollectionService+item) ⇒ <code>\*</code>
1893
+ * [.namedItem(name)](#HTMLCollectionService+namedItem) ⇒ <code>\*</code>
1894
+
1895
+ <a name="new_HTMLCollectionService_new"></a>
1896
+
1897
+ ### new HTMLCollectionService(owner, [predicate], [deep])
1898
+
1899
+ | Param | Type | Default | Description |
1900
+ | --- | --- | --- | --- |
1901
+ | owner | [<code>NodeService</code>](#NodeService) | | The node this is a live view of a part of |
1902
+ | [predicate] | <code>function</code> | | Only elements which pass this are included (every element by default) |
1903
+ | [deep] | <code>boolean</code> | <code>false</code> | Include every matching descendant (true, like getElementsByTagName), not just the direct element children (false, like Element.children) |
1904
+
1905
+ <a name="HTMLCollectionService+length"></a>
1906
+
1907
+ ### htmlCollectionService.length ⇒ <code>number</code>
1908
+ How many elements are in the collection right now.
1909
+
1910
+ **Kind**: instance property of [<code>HTMLCollectionService</code>](#HTMLCollectionService)
1911
+ <a name="HTMLCollectionService+elements"></a>
1912
+
1913
+ ### htmlCollectionService.elements() ⇒ <code>Array.&lt;PseudoNode&gt;</code>
1914
+ The current elements the collection holds, in tree order.
1915
+
1916
+ **Kind**: instance method of [<code>HTMLCollectionService</code>](#HTMLCollectionService)
1917
+ <a name="HTMLCollectionService+item"></a>
1918
+
1919
+ ### htmlCollectionService.item(index) ⇒ <code>\*</code>
1920
+ The element at the given index, or null when there is none.
1921
+
1922
+ **Kind**: instance method of [<code>HTMLCollectionService</code>](#HTMLCollectionService)
1923
+
1924
+ | Param | Type |
1925
+ | --- | --- |
1926
+ | index | <code>number</code> |
1927
+
1928
+ <a name="HTMLCollectionService+namedItem"></a>
1929
+
1930
+ ### htmlCollectionService.namedItem(name) ⇒ <code>\*</code>
1931
+ The element whose id, or (failing that) whose name attribute, is the given value, or null when there is none.
1932
+
1933
+ **Kind**: instance method of [<code>HTMLCollectionService</code>](#HTMLCollectionService)
1934
+
1935
+ | Param | Type |
1936
+ | --- | --- |
1937
+ | name | <code>string</code> |
1938
+
1367
1939
  <a name="FocusEventService"></a>
1368
1940
 
1369
1941
  ## FocusEventService ⇐ [<code>UIEventService</code>](#UIEventService)
@@ -1666,10 +2238,21 @@ Simulate the behaviour of the Element Class when there is no DOM available.
1666
2238
 
1667
2239
  * [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
1668
2240
  * [new ElementService([settings])](#new_ElementService_new)
2241
+ * [.children](#ElementService+children) ⇒ <code>PseudoHTMLCollection</code>
2242
+ * [.childElementCount](#ElementService+childElementCount) ⇒ <code>number</code>
2243
+ * [.firstElementChild](#ElementService+firstElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
2244
+ * [.lastElementChild](#ElementService+lastElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
2245
+ * [.nextElementSibling](#ElementService+nextElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
2246
+ * [.previousElementSibling](#ElementService+previousElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
1669
2247
  * [.currentAttributes()](#ElementService+currentAttributes) ⇒ <code>Array.&lt;{name: string, value: \*}&gt;</code>
1670
2248
  * [.cloneShallow()](#ElementService+cloneShallow) ⇒ [<code>ElementService</code>](#ElementService)
1671
2249
  * [.equalsShallow(other)](#ElementService+equalsShallow) ⇒ <code>boolean</code>
1672
- * [.applyDefaultEvent()](#ElementService+applyDefaultEvent) ⇒ <code>function</code>
2250
+ * [.insertAdjacentElement(position, element)](#ElementService+insertAdjacentElement) ⇒ [<code>ElementService</code>](#ElementService) \| <code>null</code>
2251
+ * [.insertAdjacentText(position, text)](#ElementService+insertAdjacentText)
2252
+ * [.insertAdjacent(position, node)](#ElementService+insertAdjacent) ⇒ <code>PseudoNode</code> \| <code>null</code>
2253
+ * [.insertAdjacentHTML(position, text)](#ElementService+insertAdjacentHTML)
2254
+ * [.matches(selectors)](#ElementService+matches) ⇒ <code>boolean</code>
2255
+ * [.closest(selectors)](#ElementService+closest) ⇒ <code>PseudoElement</code> \| <code>null</code>
1673
2256
  * [.childInserted(child)](#ElementService+childInserted)
1674
2257
  * [.hasAttribute(attributeName)](#ElementService+hasAttribute) ⇒ <code>boolean</code>
1675
2258
  * [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
@@ -1688,6 +2271,42 @@ Simulate the behaviour of the Element Class when there is no DOM available.
1688
2271
  | [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The node to add this element to as its last child |
1689
2272
  | [settings.children] | <code>Array.&lt;PseudoNode&gt;</code> | <code>[]</code> | The nodes to start as children |
1690
2273
 
2274
+ <a name="ElementService+children"></a>
2275
+
2276
+ ### elementService.children ⇒ <code>PseudoHTMLCollection</code>
2277
+ A live view of this element's element children (text, comments and the like are not included).
2278
+
2279
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
2280
+ <a name="ElementService+childElementCount"></a>
2281
+
2282
+ ### elementService.childElementCount ⇒ <code>number</code>
2283
+ How many element children this element has.
2284
+
2285
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
2286
+ <a name="ElementService+firstElementChild"></a>
2287
+
2288
+ ### elementService.firstElementChild ⇒ <code>PseudoElement</code> \| <code>null</code>
2289
+ The first child of this element which is an element, or null when there is none.
2290
+
2291
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
2292
+ <a name="ElementService+lastElementChild"></a>
2293
+
2294
+ ### elementService.lastElementChild ⇒ <code>PseudoElement</code> \| <code>null</code>
2295
+ The last child of this element which is an element, or null when there is none.
2296
+
2297
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
2298
+ <a name="ElementService+nextElementSibling"></a>
2299
+
2300
+ ### elementService.nextElementSibling ⇒ <code>PseudoElement</code> \| <code>null</code>
2301
+ The sibling after this one which is an element, or null when there is none.
2302
+
2303
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
2304
+ <a name="ElementService+previousElementSibling"></a>
2305
+
2306
+ ### elementService.previousElementSibling ⇒ <code>PseudoElement</code> \| <code>null</code>
2307
+ The sibling before this one which is an element, or null when there is none.
2308
+
2309
+ **Kind**: instance property of [<code>ElementService</code>](#ElementService)
1691
2310
  <a name="ElementService+currentAttributes"></a>
1692
2311
 
1693
2312
  ### elementService.currentAttributes() ⇒ <code>Array.&lt;{name: string, value: \*}&gt;</code>
@@ -1714,12 +2333,97 @@ checks before it compares the children.
1714
2333
  | --- | --- | --- |
1715
2334
  | other | [<code>NodeService</code>](#NodeService) | The element to compare with |
1716
2335
 
1717
- <a name="ElementService+applyDefaultEvent"></a>
2336
+ <a name="ElementService+insertAdjacentElement"></a>
2337
+
2338
+ ### elementService.insertAdjacentElement(position, element) ⇒ [<code>ElementService</code>](#ElementService) \| <code>null</code>
2339
+ Put an element at a position relative to this one: beforebegin (before this element, as its previous sibling),
2340
+ afterbegin (as this element's first child), beforeend (as this element's last child) or afterend (after this
2341
+ element, as its next sibling).
2342
+
2343
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2344
+ **Returns**: [<code>ElementService</code>](#ElementService) \| <code>null</code> - The inserted element, or null when the position needed a parent this element does not have
2345
+ **Throws**:
2346
+
2347
+ - <code>Error</code> When the position is not one of the four above
2348
+
2349
+
2350
+ | Param | Type | Description |
2351
+ | --- | --- | --- |
2352
+ | position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
2353
+ | element | [<code>ElementService</code>](#ElementService) | The element to insert |
2354
+
2355
+ <a name="ElementService+insertAdjacentText"></a>
1718
2356
 
1719
- ### elementService.applyDefaultEvent() ⇒ <code>function</code>
1720
- Some elements have default behaviour, this registers it when the element is added.
2357
+ ### elementService.insertAdjacentText(position, text)
2358
+ Put text at a position relative to this element, the same as insertAdjacentElement but the text becomes a text node.
1721
2359
 
1722
2360
  **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2361
+ **Throws**:
2362
+
2363
+ - <code>Error</code> When the position is not one of the four above
2364
+
2365
+
2366
+ | Param | Type | Description |
2367
+ | --- | --- | --- |
2368
+ | position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
2369
+ | text | <code>string</code> | The text to insert |
2370
+
2371
+ <a name="ElementService+insertAdjacent"></a>
2372
+
2373
+ ### elementService.insertAdjacent(position, node) ⇒ <code>PseudoNode</code> \| <code>null</code>
2374
+ Shared implementation for insertAdjacentElement / insertAdjacentText.
2375
+
2376
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2377
+ **Returns**: <code>PseudoNode</code> \| <code>null</code> - The inserted node, or null when the position needed a parent this element does not have
2378
+ **Throws**:
2379
+
2380
+ - <code>Error</code> When the position is not one of the four above
2381
+
2382
+
2383
+ | Param | Type | Description |
2384
+ | --- | --- | --- |
2385
+ | position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
2386
+ | node | <code>PseudoNode</code> \| <code>string</code> | The node (or text) to insert |
2387
+
2388
+ <a name="ElementService+insertAdjacentHTML"></a>
2389
+
2390
+ ### elementService.insertAdjacentHTML(position, text)
2391
+ Not implemented yet (HTML parsing is out of scope for now).
2392
+
2393
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2394
+ **Throws**:
2395
+
2396
+ - <code>Error</code>
2397
+
2398
+
2399
+ | Param | Type | Description |
2400
+ | --- | --- | --- |
2401
+ | position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
2402
+ | text | <code>string</code> | The markup which would be parsed |
2403
+
2404
+ <a name="ElementService+matches"></a>
2405
+
2406
+ ### elementService.matches(selectors) ⇒ <code>boolean</code>
2407
+ Whether this element itself (not its descendants) matches the given CSS selector.
2408
+
2409
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2410
+
2411
+ | Param | Type | Description |
2412
+ | --- | --- | --- |
2413
+ | selectors | <code>string</code> | A CSS selector |
2414
+
2415
+ <a name="ElementService+closest"></a>
2416
+
2417
+ ### elementService.closest(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
2418
+ The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or
2419
+ null when none of them do.
2420
+
2421
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
2422
+
2423
+ | Param | Type | Description |
2424
+ | --- | --- | --- |
2425
+ | selectors | <code>string</code> | A CSS selector |
2426
+
1723
2427
  <a name="ElementService+childInserted"></a>
1724
2428
 
1725
2429
  ### elementService.childInserted(child)
@@ -1788,9 +2492,22 @@ Simulate the behaviour of the Document Class when there is no DOM available.
1788
2492
 
1789
2493
  * [DocumentService](#DocumentService) ⇐ [<code>NodeService</code>](#NodeService)
1790
2494
  * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
2495
+ * [.getElementById(id)](#DocumentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
1791
2496
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
1792
2497
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
1793
2498
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
2499
+ * [.append(...nodes)](#NodeService+append)
2500
+ * [.prepend(...nodes)](#NodeService+prepend)
2501
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
2502
+ * [.before(...nodes)](#NodeService+before)
2503
+ * [.after(...nodes)](#NodeService+after)
2504
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
2505
+ * [.remove()](#NodeService+remove)
2506
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
2507
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
2508
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
2509
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
2510
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
1794
2511
  * [.childInserted(child)](#NodeService+childInserted)
1795
2512
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
1796
2513
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -1807,6 +2524,17 @@ Simulate the behaviour of the Document Class when there is no DOM available.
1807
2524
  Whether this kind of node can have children (text, comments and attributes cannot).
1808
2525
 
1809
2526
  **Kind**: instance property of [<code>DocumentService</code>](#DocumentService)
2527
+ <a name="DocumentService+getElementById"></a>
2528
+
2529
+ ### documentService.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
2530
+ The first element, in tree order, whose id matches the given value, or null when there is none.
2531
+
2532
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2533
+
2534
+ | Param | Type |
2535
+ | --- | --- |
2536
+ | id | <code>string</code> |
2537
+
1810
2538
  <a name="NodeService+appendChild"></a>
1811
2539
 
1812
2540
  ### documentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -1838,6 +2566,150 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
1838
2566
  | --- | --- | --- |
1839
2567
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
1840
2568
 
2569
+ <a name="NodeService+append"></a>
2570
+
2571
+ ### documentService.append(...nodes)
2572
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
2573
+
2574
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2575
+ **Throws**:
2576
+
2577
+ - <code>Error</code> When this kind of node cannot have children
2578
+
2579
+
2580
+ | Param | Type | Description |
2581
+ | --- | --- | --- |
2582
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2583
+
2584
+ <a name="NodeService+prepend"></a>
2585
+
2586
+ ### documentService.prepend(...nodes)
2587
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
2588
+
2589
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2590
+ **Throws**:
2591
+
2592
+ - <code>Error</code> When this kind of node cannot have children
2593
+
2594
+
2595
+ | Param | Type | Description |
2596
+ | --- | --- | --- |
2597
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2598
+
2599
+ <a name="NodeService+replaceChildren"></a>
2600
+
2601
+ ### documentService.replaceChildren(...nodes)
2602
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
2603
+
2604
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2605
+ **Throws**:
2606
+
2607
+ - <code>Error</code> When this kind of node cannot have children
2608
+
2609
+
2610
+ | Param | Type | Description |
2611
+ | --- | --- | --- |
2612
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2613
+
2614
+ <a name="NodeService+before"></a>
2615
+
2616
+ ### documentService.before(...nodes)
2617
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
2618
+ no parent.
2619
+
2620
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2621
+
2622
+ | Param | Type | Description |
2623
+ | --- | --- | --- |
2624
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2625
+
2626
+ <a name="NodeService+after"></a>
2627
+
2628
+ ### documentService.after(...nodes)
2629
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
2630
+ parent.
2631
+
2632
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2633
+
2634
+ | Param | Type | Description |
2635
+ | --- | --- | --- |
2636
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2637
+
2638
+ <a name="NodeService+replaceWith"></a>
2639
+
2640
+ ### documentService.replaceWith(...nodes)
2641
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
2642
+ when this node has no parent.
2643
+
2644
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2645
+
2646
+ | Param | Type | Description |
2647
+ | --- | --- | --- |
2648
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
2649
+
2650
+ <a name="NodeService+remove"></a>
2651
+
2652
+ ### documentService.remove()
2653
+ Remove this node from its parent. Does nothing when it has no parent.
2654
+
2655
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2656
+ <a name="NodeService+toChildNode"></a>
2657
+
2658
+ ### documentService.toChildNode(value) ⇒ <code>PseudoNode</code>
2659
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
2660
+ becomes a text node belonging to this node's document, anything else is returned as it is.
2661
+
2662
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2663
+
2664
+ | Param | Type | Description |
2665
+ | --- | --- | --- |
2666
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
2667
+
2668
+ <a name="NodeService+getElementsByTagName"></a>
2669
+
2670
+ ### documentService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
2671
+ Every element below this node with the given tag name (or every element when tagName is *), live.
2672
+
2673
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2674
+
2675
+ | Param | Type |
2676
+ | --- | --- |
2677
+ | tagName | <code>string</code> |
2678
+
2679
+ <a name="NodeService+getElementsByClassName"></a>
2680
+
2681
+ ### documentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
2682
+ Every element below this node which has all of the given (space separated) classes, live.
2683
+
2684
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2685
+
2686
+ | Param | Type |
2687
+ | --- | --- |
2688
+ | className | <code>string</code> |
2689
+
2690
+ <a name="NodeService+querySelector"></a>
2691
+
2692
+ ### documentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
2693
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
2694
+
2695
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2696
+
2697
+ | Param | Type | Description |
2698
+ | --- | --- | --- |
2699
+ | selectors | <code>string</code> | A CSS selector |
2700
+
2701
+ <a name="NodeService+querySelectorAll"></a>
2702
+
2703
+ ### documentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2704
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
2705
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
2706
+
2707
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2708
+
2709
+ | Param | Type | Description |
2710
+ | --- | --- | --- |
2711
+ | selectors | <code>string</code> | A CSS selector |
2712
+
1841
2713
  <a name="NodeService+childInserted"></a>
1842
2714
 
1843
2715
  ### documentService.childInserted(child)
@@ -1932,91 +2804,247 @@ Remove a child from this node, it no longer has a parent or siblings afterwards.
1932
2804
  **Returns**: <code>PseudoNode</code> - The removed node
1933
2805
  **Throws**:
1934
2806
 
1935
- - <code>Error</code> When the node is not a child of this node
2807
+ - <code>Error</code> When the node is not a child of this node
2808
+
2809
+
2810
+ | Param | Type | Description |
2811
+ | --- | --- | --- |
2812
+ | childElement | <code>PseudoNode</code> | The child node to remove |
2813
+
2814
+ <a name="NodeService+replaceChild"></a>
2815
+
2816
+ ### documentService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
2817
+ Replace a child of this node with another node (which is moved if it is already in a tree).
2818
+
2819
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
2820
+ **Returns**: <code>PseudoNode</code> - The replaced node
2821
+ **Throws**:
2822
+
2823
+ - <code>Error</code> When the old node is not a child of this node
2824
+
2825
+
2826
+ | Param | Type | Description |
2827
+ | --- | --- | --- |
2828
+ | newChild | <code>PseudoNode</code> | The node which takes the place |
2829
+ | oldChild | <code>PseudoNode</code> | The child of this node to replace |
2830
+
2831
+ <a name="DocumentFragmentService"></a>
2832
+
2833
+ ## DocumentFragmentService ⇐ [<code>NodeService</code>](#NodeService)
2834
+ Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
2835
+ not part of a tree, when it is inserted its children are moved into the tree instead.
2836
+
2837
+ **Kind**: global class
2838
+ **Extends**: [<code>NodeService</code>](#NodeService)
2839
+ **Author**: Joshua Heagle <joshuaheagle@gmail.com>
2840
+
2841
+ * [DocumentFragmentService](#DocumentFragmentService) ⇐ [<code>NodeService</code>](#NodeService)
2842
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
2843
+ * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2844
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2845
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
2846
+ * [.append(...nodes)](#NodeService+append)
2847
+ * [.prepend(...nodes)](#NodeService+prepend)
2848
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
2849
+ * [.before(...nodes)](#NodeService+before)
2850
+ * [.after(...nodes)](#NodeService+after)
2851
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
2852
+ * [.remove()](#NodeService+remove)
2853
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
2854
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
2855
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
2856
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
2857
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2858
+ * [.childInserted(child)](#NodeService+childInserted)
2859
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2860
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
2861
+ * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
2862
+ * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
2863
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
2864
+ * [.normalize()](#NodeService+normalize)
2865
+ * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
2866
+ * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
2867
+
2868
+ <a name="NodeService+acceptsChildren"></a>
2869
+
2870
+ ### documentFragmentService.acceptsChildren ⇒ <code>boolean</code>
2871
+ Whether this kind of node can have children (text, comments and attributes cannot).
2872
+
2873
+ **Kind**: instance property of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2874
+ <a name="NodeService+appendChild"></a>
2875
+
2876
+ ### documentFragmentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
2877
+ Add a node as the last child of this node (a node which is already in a tree is moved).
2878
+
2879
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2880
+ **Returns**: <code>PseudoNode</code> - The added node
2881
+
2882
+ | Param | Type | Description |
2883
+ | --- | --- | --- |
2884
+ | childNode | <code>PseudoNode</code> | The node to add |
2885
+
2886
+ <a name="NodeService+cloneShallow"></a>
2887
+
2888
+ ### documentFragmentService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
2889
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
2890
+ Kinds of node which are made with arguments override this to give them.
2891
+
2892
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2893
+ <a name="NodeService+equalsShallow"></a>
2894
+
2895
+ ### documentFragmentService.equalsShallow(other) ⇒ <code>boolean</code>
2896
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
2897
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
2898
+
2899
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2900
+
2901
+ | Param | Type | Description |
2902
+ | --- | --- | --- |
2903
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2904
+
2905
+ <a name="NodeService+append"></a>
2906
+
2907
+ ### documentFragmentService.append(...nodes)
2908
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
2909
+
2910
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2911
+ **Throws**:
2912
+
2913
+ - <code>Error</code> When this kind of node cannot have children
2914
+
2915
+
2916
+ | Param | Type | Description |
2917
+ | --- | --- | --- |
2918
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2919
+
2920
+ <a name="NodeService+prepend"></a>
2921
+
2922
+ ### documentFragmentService.prepend(...nodes)
2923
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
2924
+
2925
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2926
+ **Throws**:
2927
+
2928
+ - <code>Error</code> When this kind of node cannot have children
2929
+
2930
+
2931
+ | Param | Type | Description |
2932
+ | --- | --- | --- |
2933
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2934
+
2935
+ <a name="NodeService+replaceChildren"></a>
2936
+
2937
+ ### documentFragmentService.replaceChildren(...nodes)
2938
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
2939
+
2940
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2941
+ **Throws**:
2942
+
2943
+ - <code>Error</code> When this kind of node cannot have children
2944
+
2945
+
2946
+ | Param | Type | Description |
2947
+ | --- | --- | --- |
2948
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2949
+
2950
+ <a name="NodeService+before"></a>
2951
+
2952
+ ### documentFragmentService.before(...nodes)
2953
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
2954
+ no parent.
2955
+
2956
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2957
+
2958
+ | Param | Type | Description |
2959
+ | --- | --- | --- |
2960
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2961
+
2962
+ <a name="NodeService+after"></a>
2963
+
2964
+ ### documentFragmentService.after(...nodes)
2965
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
2966
+ parent.
2967
+
2968
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2969
+
2970
+ | Param | Type | Description |
2971
+ | --- | --- | --- |
2972
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
2973
+
2974
+ <a name="NodeService+replaceWith"></a>
2975
+
2976
+ ### documentFragmentService.replaceWith(...nodes)
2977
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
2978
+ when this node has no parent.
1936
2979
 
2980
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1937
2981
 
1938
2982
  | Param | Type | Description |
1939
2983
  | --- | --- | --- |
1940
- | childElement | <code>PseudoNode</code> | The child node to remove |
2984
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
1941
2985
 
1942
- <a name="NodeService+replaceChild"></a>
2986
+ <a name="NodeService+remove"></a>
1943
2987
 
1944
- ### documentService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
1945
- Replace a child of this node with another node (which is moved if it is already in a tree).
2988
+ ### documentFragmentService.remove()
2989
+ Remove this node from its parent. Does nothing when it has no parent.
1946
2990
 
1947
- **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1948
- **Returns**: <code>PseudoNode</code> - The replaced node
1949
- **Throws**:
2991
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2992
+ <a name="NodeService+toChildNode"></a>
1950
2993
 
1951
- - <code>Error</code> When the old node is not a child of this node
2994
+ ### documentFragmentService.toChildNode(value) ⇒ <code>PseudoNode</code>
2995
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
2996
+ becomes a text node belonging to this node's document, anything else is returned as it is.
1952
2997
 
2998
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1953
2999
 
1954
3000
  | Param | Type | Description |
1955
3001
  | --- | --- | --- |
1956
- | newChild | <code>PseudoNode</code> | The node which takes the place |
1957
- | oldChild | <code>PseudoNode</code> | The child of this node to replace |
3002
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
1958
3003
 
1959
- <a name="DocumentFragmentService"></a>
3004
+ <a name="NodeService+getElementsByTagName"></a>
1960
3005
 
1961
- ## DocumentFragmentService [<code>NodeService</code>](#NodeService)
1962
- Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
1963
- not part of a tree, when it is inserted its children are moved into the tree instead.
3006
+ ### documentFragmentService.getElementsByTagName(tagName) <code>PseudoHTMLCollection</code>
3007
+ Every element below this node with the given tag name (or every element when tagName is *), live.
1964
3008
 
1965
- **Kind**: global class
1966
- **Extends**: [<code>NodeService</code>](#NodeService)
1967
- **Author**: Joshua Heagle <joshuaheagle@gmail.com>
3009
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1968
3010
 
1969
- * [DocumentFragmentService](#DocumentFragmentService) [<code>NodeService</code>](#NodeService)
1970
- * [.acceptsChildren](#NodeService+acceptsChildren) <code>boolean</code>
1971
- * [.appendChild(childNode)](#NodeService+appendChild) <code>PseudoNode</code>
1972
- * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
1973
- * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1974
- * [.childInserted(child)](#NodeService+childInserted)
1975
- * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
1976
- * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
1977
- * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
1978
- * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
1979
- * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
1980
- * [.normalize()](#NodeService+normalize)
1981
- * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
1982
- * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
3011
+ | Param | Type |
3012
+ | --- | --- |
3013
+ | tagName | <code>string</code> |
1983
3014
 
1984
- <a name="NodeService+acceptsChildren"></a>
3015
+ <a name="NodeService+getElementsByClassName"></a>
1985
3016
 
1986
- ### documentFragmentService.acceptsChildren ⇒ <code>boolean</code>
1987
- Whether this kind of node can have children (text, comments and attributes cannot).
3017
+ ### documentFragmentService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
3018
+ Every element below this node which has all of the given (space separated) classes, live.
1988
3019
 
1989
- **Kind**: instance property of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1990
- <a name="NodeService+appendChild"></a>
3020
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1991
3021
 
1992
- ### documentFragmentService.appendChild(childNode) <code>PseudoNode</code>
1993
- Add a node as the last child of this node (a node which is already in a tree is moved).
3022
+ | Param | Type |
3023
+ | --- | --- |
3024
+ | className | <code>string</code> |
3025
+
3026
+ <a name="NodeService+querySelector"></a>
3027
+
3028
+ ### documentFragmentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
3029
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
1994
3030
 
1995
3031
  **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1996
- **Returns**: <code>PseudoNode</code> - The added node
1997
3032
 
1998
3033
  | Param | Type | Description |
1999
3034
  | --- | --- | --- |
2000
- | childNode | <code>PseudoNode</code> | The node to add |
2001
-
2002
- <a name="NodeService+cloneShallow"></a>
2003
-
2004
- ### documentFragmentService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
2005
- Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
2006
- Kinds of node which are made with arguments override this to give them.
3035
+ | selectors | <code>string</code> | A CSS selector |
2007
3036
 
2008
- **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2009
- <a name="NodeService+equalsShallow"></a>
3037
+ <a name="NodeService+querySelectorAll"></a>
2010
3038
 
2011
- ### documentFragmentService.equalsShallow(other) ⇒ <code>boolean</code>
2012
- Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
2013
- afterwards. Kinds of node with more to compare (an element has attributes) override this.
3039
+ ### documentFragmentService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3040
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
3041
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
2014
3042
 
2015
3043
  **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2016
3044
 
2017
3045
  | Param | Type | Description |
2018
3046
  | --- | --- | --- |
2019
- | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
3047
+ | selectors | <code>string</code> | A CSS selector |
2020
3048
 
2021
3049
  <a name="NodeService+childInserted"></a>
2022
3050
 
@@ -2236,6 +3264,18 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
2236
3264
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2237
3265
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2238
3266
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
3267
+ * [.append(...nodes)](#NodeService+append)
3268
+ * [.prepend(...nodes)](#NodeService+prepend)
3269
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
3270
+ * [.before(...nodes)](#NodeService+before)
3271
+ * [.after(...nodes)](#NodeService+after)
3272
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
3273
+ * [.remove()](#NodeService+remove)
3274
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
3275
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
3276
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
3277
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
3278
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2239
3279
  * [.childInserted(child)](#NodeService+childInserted)
2240
3280
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2241
3281
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -2299,6 +3339,162 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
2299
3339
  | --- | --- | --- |
2300
3340
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2301
3341
 
3342
+ <a name="NodeService+append"></a>
3343
+
3344
+ ### attrService.append(...nodes)
3345
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
3346
+
3347
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3348
+ **Overrides**: [<code>append</code>](#NodeService+append)
3349
+ **Throws**:
3350
+
3351
+ - <code>Error</code> When this kind of node cannot have children
3352
+
3353
+
3354
+ | Param | Type | Description |
3355
+ | --- | --- | --- |
3356
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3357
+
3358
+ <a name="NodeService+prepend"></a>
3359
+
3360
+ ### attrService.prepend(...nodes)
3361
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
3362
+
3363
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3364
+ **Overrides**: [<code>prepend</code>](#NodeService+prepend)
3365
+ **Throws**:
3366
+
3367
+ - <code>Error</code> When this kind of node cannot have children
3368
+
3369
+
3370
+ | Param | Type | Description |
3371
+ | --- | --- | --- |
3372
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3373
+
3374
+ <a name="NodeService+replaceChildren"></a>
3375
+
3376
+ ### attrService.replaceChildren(...nodes)
3377
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
3378
+
3379
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3380
+ **Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
3381
+ **Throws**:
3382
+
3383
+ - <code>Error</code> When this kind of node cannot have children
3384
+
3385
+
3386
+ | Param | Type | Description |
3387
+ | --- | --- | --- |
3388
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3389
+
3390
+ <a name="NodeService+before"></a>
3391
+
3392
+ ### attrService.before(...nodes)
3393
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
3394
+ no parent.
3395
+
3396
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3397
+ **Overrides**: [<code>before</code>](#NodeService+before)
3398
+
3399
+ | Param | Type | Description |
3400
+ | --- | --- | --- |
3401
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3402
+
3403
+ <a name="NodeService+after"></a>
3404
+
3405
+ ### attrService.after(...nodes)
3406
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
3407
+ parent.
3408
+
3409
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3410
+ **Overrides**: [<code>after</code>](#NodeService+after)
3411
+
3412
+ | Param | Type | Description |
3413
+ | --- | --- | --- |
3414
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3415
+
3416
+ <a name="NodeService+replaceWith"></a>
3417
+
3418
+ ### attrService.replaceWith(...nodes)
3419
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
3420
+ when this node has no parent.
3421
+
3422
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3423
+ **Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
3424
+
3425
+ | Param | Type | Description |
3426
+ | --- | --- | --- |
3427
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
3428
+
3429
+ <a name="NodeService+remove"></a>
3430
+
3431
+ ### attrService.remove()
3432
+ Remove this node from its parent. Does nothing when it has no parent.
3433
+
3434
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3435
+ **Overrides**: [<code>remove</code>](#NodeService+remove)
3436
+ <a name="NodeService+toChildNode"></a>
3437
+
3438
+ ### attrService.toChildNode(value) ⇒ <code>PseudoNode</code>
3439
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
3440
+ becomes a text node belonging to this node's document, anything else is returned as it is.
3441
+
3442
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3443
+ **Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
3444
+
3445
+ | Param | Type | Description |
3446
+ | --- | --- | --- |
3447
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
3448
+
3449
+ <a name="NodeService+getElementsByTagName"></a>
3450
+
3451
+ ### attrService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
3452
+ Every element below this node with the given tag name (or every element when tagName is *), live.
3453
+
3454
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3455
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
3456
+
3457
+ | Param | Type |
3458
+ | --- | --- |
3459
+ | tagName | <code>string</code> |
3460
+
3461
+ <a name="NodeService+getElementsByClassName"></a>
3462
+
3463
+ ### attrService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
3464
+ Every element below this node which has all of the given (space separated) classes, live.
3465
+
3466
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3467
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
3468
+
3469
+ | Param | Type |
3470
+ | --- | --- |
3471
+ | className | <code>string</code> |
3472
+
3473
+ <a name="NodeService+querySelector"></a>
3474
+
3475
+ ### attrService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
3476
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
3477
+
3478
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3479
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
3480
+
3481
+ | Param | Type | Description |
3482
+ | --- | --- | --- |
3483
+ | selectors | <code>string</code> | A CSS selector |
3484
+
3485
+ <a name="NodeService+querySelectorAll"></a>
3486
+
3487
+ ### attrService.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3488
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
3489
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
3490
+
3491
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
3492
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
3493
+
3494
+ | Param | Type | Description |
3495
+ | --- | --- | --- |
3496
+ | selectors | <code>string</code> | A CSS selector |
3497
+
2302
3498
  <a name="NodeService+childInserted"></a>
2303
3499
 
2304
3500
  ### attrService.childInserted(child)
@@ -2442,6 +3638,18 @@ from that linker, and its parent from the linker's parent when it has not been g
2442
3638
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2443
3639
  * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2444
3640
  * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
3641
+ * [.append(...nodes)](#NodeService+append)
3642
+ * [.prepend(...nodes)](#NodeService+prepend)
3643
+ * [.replaceChildren(...nodes)](#NodeService+replaceChildren)
3644
+ * [.before(...nodes)](#NodeService+before)
3645
+ * [.after(...nodes)](#NodeService+after)
3646
+ * [.replaceWith(...nodes)](#NodeService+replaceWith)
3647
+ * [.remove()](#NodeService+remove)
3648
+ * [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
3649
+ * [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
3650
+ * [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
3651
+ * [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
3652
+ * [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
2445
3653
  * [.childInserted(child)](#NodeService+childInserted)
2446
3654
  * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2447
3655
  * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
@@ -2502,6 +3710,162 @@ afterwards. Kinds of node with more to compare (an element has attributes) overr
2502
3710
  | --- | --- | --- |
2503
3711
  | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2504
3712
 
3713
+ <a name="NodeService+append"></a>
3714
+
3715
+ ### linkedNode.append(...nodes)
3716
+ Add nodes (strings become text nodes) as the last children of this node, in the order given.
3717
+
3718
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3719
+ **Overrides**: [<code>append</code>](#NodeService+append)
3720
+ **Throws**:
3721
+
3722
+ - <code>Error</code> When this kind of node cannot have children
3723
+
3724
+
3725
+ | Param | Type | Description |
3726
+ | --- | --- | --- |
3727
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3728
+
3729
+ <a name="NodeService+prepend"></a>
3730
+
3731
+ ### linkedNode.prepend(...nodes)
3732
+ Add nodes (strings become text nodes) as the first children of this node, in the order given.
3733
+
3734
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3735
+ **Overrides**: [<code>prepend</code>](#NodeService+prepend)
3736
+ **Throws**:
3737
+
3738
+ - <code>Error</code> When this kind of node cannot have children
3739
+
3740
+
3741
+ | Param | Type | Description |
3742
+ | --- | --- | --- |
3743
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3744
+
3745
+ <a name="NodeService+replaceChildren"></a>
3746
+
3747
+ ### linkedNode.replaceChildren(...nodes)
3748
+ Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
3749
+
3750
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3751
+ **Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
3752
+ **Throws**:
3753
+
3754
+ - <code>Error</code> When this kind of node cannot have children
3755
+
3756
+
3757
+ | Param | Type | Description |
3758
+ | --- | --- | --- |
3759
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3760
+
3761
+ <a name="NodeService+before"></a>
3762
+
3763
+ ### linkedNode.before(...nodes)
3764
+ Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
3765
+ no parent.
3766
+
3767
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3768
+ **Overrides**: [<code>before</code>](#NodeService+before)
3769
+
3770
+ | Param | Type | Description |
3771
+ | --- | --- | --- |
3772
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3773
+
3774
+ <a name="NodeService+after"></a>
3775
+
3776
+ ### linkedNode.after(...nodes)
3777
+ Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
3778
+ parent.
3779
+
3780
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3781
+ **Overrides**: [<code>after</code>](#NodeService+after)
3782
+
3783
+ | Param | Type | Description |
3784
+ | --- | --- | --- |
3785
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
3786
+
3787
+ <a name="NodeService+replaceWith"></a>
3788
+
3789
+ ### linkedNode.replaceWith(...nodes)
3790
+ Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
3791
+ when this node has no parent.
3792
+
3793
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3794
+ **Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
3795
+
3796
+ | Param | Type | Description |
3797
+ | --- | --- | --- |
3798
+ | ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
3799
+
3800
+ <a name="NodeService+remove"></a>
3801
+
3802
+ ### linkedNode.remove()
3803
+ Remove this node from its parent. Does nothing when it has no parent.
3804
+
3805
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3806
+ **Overrides**: [<code>remove</code>](#NodeService+remove)
3807
+ <a name="NodeService+toChildNode"></a>
3808
+
3809
+ ### linkedNode.toChildNode(value) ⇒ <code>PseudoNode</code>
3810
+ Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
3811
+ becomes a text node belonging to this node's document, anything else is returned as it is.
3812
+
3813
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3814
+ **Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
3815
+
3816
+ | Param | Type | Description |
3817
+ | --- | --- | --- |
3818
+ | value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
3819
+
3820
+ <a name="NodeService+getElementsByTagName"></a>
3821
+
3822
+ ### linkedNode.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
3823
+ Every element below this node with the given tag name (or every element when tagName is *), live.
3824
+
3825
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3826
+ **Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
3827
+
3828
+ | Param | Type |
3829
+ | --- | --- |
3830
+ | tagName | <code>string</code> |
3831
+
3832
+ <a name="NodeService+getElementsByClassName"></a>
3833
+
3834
+ ### linkedNode.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
3835
+ Every element below this node which has all of the given (space separated) classes, live.
3836
+
3837
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3838
+ **Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
3839
+
3840
+ | Param | Type |
3841
+ | --- | --- |
3842
+ | className | <code>string</code> |
3843
+
3844
+ <a name="NodeService+querySelector"></a>
3845
+
3846
+ ### linkedNode.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
3847
+ The first element below this node which matches the CSS selector, in tree order, or null when there is none.
3848
+
3849
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3850
+ **Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
3851
+
3852
+ | Param | Type | Description |
3853
+ | --- | --- | --- |
3854
+ | selectors | <code>string</code> | A CSS selector |
3855
+
3856
+ <a name="NodeService+querySelectorAll"></a>
3857
+
3858
+ ### linkedNode.querySelectorAll(selectors) ⇒ <code>Array.&lt;PseudoElement&gt;</code>
3859
+ Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
3860
+ collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
3861
+
3862
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
3863
+ **Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
3864
+
3865
+ | Param | Type | Description |
3866
+ | --- | --- | --- |
3867
+ | selectors | <code>string</code> | A CSS selector |
3868
+
2505
3869
  <a name="NodeService+childInserted"></a>
2506
3870
 
2507
3871
  ### linkedNode.childInserted(child)
@@ -3041,6 +4405,18 @@ Create an instance of HTMLElement if not available
3041
4405
  Define document when not available
3042
4406
 
3043
4407
  **Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
4408
+ <a name="nearestElementSibling"></a>
4409
+
4410
+ ## nearestElementSibling(node, direction) ⇒ <code>\*</code> \| <code>null</code>
4411
+ Walk up from a node (not including it) to find the nearest element, in the given direction.
4412
+
4413
+ **Kind**: global function
4414
+
4415
+ | Param | Type | Description |
4416
+ | --- | --- | --- |
4417
+ | node | <code>\*</code> | The node to start from |
4418
+ | direction | <code>&#x27;nextSibling&#x27;</code> \| <code>&#x27;previousSibling&#x27;</code> | Which sibling reference to follow |
4419
+
3044
4420
  <a name="createEvent"></a>
3045
4421
 
3046
4422
  ## createEvent(type, [init], [options]) ⇒ [<code>EventService</code>](#EventService)