pseudo-dom 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -29,7 +29,16 @@ are `PseudoUIEvent`, `PseudoMouseEvent`, `PseudoPointerEvent`, `PseudoKeyboardEv
29
29
  tree), and `simulate.click(element)` / `simulate.keyPress(element, key)` send what a user's action sends (pointerdown,
30
30
  mousedown, the focus moving, pointerup, mouseup, click; keydown, keyup), all trusted.
31
31
 
32
- Not implemented yet (these throw a "not implemented" error or are missing): `cloneNode`, `compareDocumentPosition`, `isEqualNode`, `querySelector` /
32
+ Nodes can be copied and compared: `cloneNode(deep)` copies an element with its attributes (objects such as `style` are
33
+ copied too, not shared) and, when deep, everything below it, without the parent or the event listeners; `isEqualNode`
34
+ compares two nodes by what they hold (tag, attributes in any order, text and children in order);
35
+ `compareDocumentPosition` says where another node is (`NodeService.DOCUMENT_POSITION_*`); `isConnected` is true when the
36
+ tree has a document at the top and `ownerDocument` says which one made the node; `normalize` joins neighbouring text
37
+ nodes. There are text and comment nodes (`PseudoText`, `PseudoComment`) and `textContent` works like the DOM's (the text
38
+ of everything below, and setting it replaces the children with a text node); the document makes them with
39
+ `createTextNode`, `createComment` and `createDocumentFragment`.
40
+
41
+ Not implemented yet (these throw a "not implemented" error or are missing): `querySelector` /
33
42
  `querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the Element and Document APIs. The API
34
43
  will change before 1.0.
35
44
  ## Modules
@@ -56,6 +65,12 @@ interface (the mouse, the keyboard, focus and input).</p>
56
65
  <dt><a href="#NodeService">NodeService</a> ⇐ <code>PseudoEventTarget</code></dt>
57
66
  <dd><p>Simulate the behaviour of the Node Class when there is no DOM available.</p>
58
67
  </dd>
68
+ <dt><a href="#TextService">TextService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
69
+ <dd><p>Simulate the behaviour of the Text Class when there is no DOM available: the text in an element.</p>
70
+ </dd>
71
+ <dt><a href="#CommentService">CommentService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
72
+ <dd><p>Simulate the behaviour of the Comment Class when there is no DOM available: a note in the markup which is not shown.</p>
73
+ </dd>
59
74
  <dt><a href="#NamedNodeMapService">NamedNodeMapService</a></dt>
60
75
  <dd><p>Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.</p>
61
76
  </dd>
@@ -418,16 +433,26 @@ Simulate the behaviour of the Node Class when there is no DOM available.
418
433
 
419
434
 
420
435
  * [NodeService](#NodeService) ⇐ <code>PseudoEventTarget</code>
436
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
421
437
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
438
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
439
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
422
440
  * [.childInserted(child)](#NodeService+childInserted)
423
- * [.cloneNode()](#NodeService+cloneNode)
424
- * [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
441
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
442
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
425
443
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
426
444
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
427
- * [.isEqualNode()](#NodeService+isEqualNode)
445
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
446
+ * [.normalize()](#NodeService+normalize)
428
447
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
429
448
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
430
449
 
450
+ <a name="NodeService+acceptsChildren"></a>
451
+
452
+ ### nodeService.acceptsChildren ⇒ <code>boolean</code>
453
+ Whether this kind of node can have children (text, comments and attributes cannot).
454
+
455
+ **Kind**: instance property of [<code>NodeService</code>](#NodeService)
431
456
  <a name="NodeService+appendChild"></a>
432
457
 
433
458
  ### nodeService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -440,6 +465,25 @@ Add a node as the last child of this node (a node which is already in a tree is
440
465
  | --- | --- | --- |
441
466
  | childNode | <code>PseudoNode</code> | The node to add |
442
467
 
468
+ <a name="NodeService+cloneShallow"></a>
469
+
470
+ ### nodeService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
471
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
472
+ Kinds of node which are made with arguments override this to give them.
473
+
474
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
475
+ <a name="NodeService+equalsShallow"></a>
476
+
477
+ ### nodeService.equalsShallow(other) ⇒ <code>boolean</code>
478
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
479
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
480
+
481
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
482
+
483
+ | Param | Type | Description |
484
+ | --- | --- | --- |
485
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
486
+
443
487
  <a name="NodeService+childInserted"></a>
444
488
 
445
489
  ### nodeService.childInserted(child)
@@ -454,23 +498,29 @@ Called each time a node has been inserted as a child of this node, so that nodes
454
498
 
455
499
  <a name="NodeService+cloneNode"></a>
456
500
 
457
- ### nodeService.cloneNode()
458
- Not implemented yet.
501
+ ### nodeService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
502
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
503
+ too, all the way down.
459
504
 
460
505
  **Kind**: instance method of [<code>NodeService</code>](#NodeService)
461
- **Throws**:
462
506
 
463
- - <code>Error</code>
507
+ | Param | Type | Default | Description |
508
+ | --- | --- | --- | --- |
509
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
464
510
 
465
511
  <a name="NodeService+compareDocumentPosition"></a>
466
512
 
467
- ### nodeService.compareDocumentPosition()
468
- Not implemented yet.
513
+ ### nodeService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
514
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
515
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
516
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
517
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
469
518
 
470
519
  **Kind**: instance method of [<code>NodeService</code>](#NodeService)
471
- **Throws**:
472
520
 
473
- - <code>Error</code>
521
+ | Param | Type | Description |
522
+ | --- | --- | --- |
523
+ | otherNode | <code>PseudoNode</code> | The node to locate |
474
524
 
475
525
  <a name="NodeService+contains"></a>
476
526
 
@@ -503,14 +553,22 @@ already in a tree is moved, and the children of a document fragment are moved in
503
553
 
504
554
  <a name="NodeService+isEqualNode"></a>
505
555
 
506
- ### nodeService.isEqualNode()
507
- Not implemented yet.
556
+ ### nodeService.isEqualNode(otherNode) ⇒ <code>boolean</code>
557
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
558
+ needs the same attributes), and children which are equal in the same order.
508
559
 
509
560
  **Kind**: instance method of [<code>NodeService</code>](#NodeService)
510
- **Throws**:
511
561
 
512
- - <code>Error</code>
562
+ | Param | Type | Description |
563
+ | --- | --- | --- |
564
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
565
+
566
+ <a name="NodeService+normalize"></a>
567
+
568
+ ### nodeService.normalize()
569
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
513
570
 
571
+ **Kind**: instance method of [<code>NodeService</code>](#NodeService)
514
572
  <a name="NodeService+removeChild"></a>
515
573
 
516
574
  ### nodeService.removeChild(childElement) ⇒ <code>PseudoNode</code>
@@ -539,6 +597,441 @@ Replace a child of this node with another node (which is moved if it is already
539
597
  - <code>Error</code> When the old node is not a child of this node
540
598
 
541
599
 
600
+ | Param | Type | Description |
601
+ | --- | --- | --- |
602
+ | newChild | <code>PseudoNode</code> | The node which takes the place |
603
+ | oldChild | <code>PseudoNode</code> | The child of this node to replace |
604
+
605
+ <a name="TextService"></a>
606
+
607
+ ## TextService ⇐ [<code>NodeService</code>](#NodeService)
608
+ Simulate the behaviour of the Text Class when there is no DOM available: the text in an element.
609
+
610
+ **Kind**: global class
611
+ **Extends**: [<code>NodeService</code>](#NodeService)
612
+ **Author**: Joshua Heagle <joshuaheagle@gmail.com>
613
+ **Properties**
614
+
615
+ | Name | Type | Description |
616
+ | --- | --- | --- |
617
+ | data | <code>string</code> | The text |
618
+ | length | <code>number</code> | How many characters there are |
619
+ | wholeText | <code>string</code> | The text of this node and of the text nodes next to it |
620
+
621
+
622
+ * [TextService](#TextService) ⇐ [<code>NodeService</code>](#NodeService)
623
+ * [new TextService([data])](#new_TextService_new)
624
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
625
+ * [.splitText(offset)](#TextService+splitText) ⇒ [<code>TextService</code>](#TextService)
626
+ * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
627
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
628
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
629
+ * [.childInserted(child)](#NodeService+childInserted)
630
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
631
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
632
+ * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
633
+ * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
634
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
635
+ * [.normalize()](#NodeService+normalize)
636
+ * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
637
+ * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
638
+
639
+ <a name="new_TextService_new"></a>
640
+
641
+ ### new TextService([data])
642
+
643
+ | Param | Type | Default | Description |
644
+ | --- | --- | --- | --- |
645
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The text |
646
+
647
+ <a name="NodeService+acceptsChildren"></a>
648
+
649
+ ### textService.acceptsChildren ⇒ <code>boolean</code>
650
+ Whether this kind of node can have children (text, comments and attributes cannot).
651
+
652
+ **Kind**: instance property of [<code>TextService</code>](#TextService)
653
+ **Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
654
+ <a name="TextService+splitText"></a>
655
+
656
+ ### textService.splitText(offset) ⇒ [<code>TextService</code>](#TextService)
657
+ Break this text node in two at a position: this node keeps the text before it and a new node with the rest is put
658
+ after this one.
659
+
660
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
661
+ **Returns**: [<code>TextService</code>](#TextService) - The new node
662
+ **Throws**:
663
+
664
+ - <code>Error</code> When the offset is beyond the end of the text
665
+
666
+
667
+ | Param | Type | Description |
668
+ | --- | --- | --- |
669
+ | offset | <code>number</code> | How many characters stay in this node |
670
+
671
+ <a name="NodeService+appendChild"></a>
672
+
673
+ ### textService.appendChild(childNode) ⇒ <code>PseudoNode</code>
674
+ Add a node as the last child of this node (a node which is already in a tree is moved).
675
+
676
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
677
+ **Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
678
+ **Returns**: <code>PseudoNode</code> - The added node
679
+
680
+ | Param | Type | Description |
681
+ | --- | --- | --- |
682
+ | childNode | <code>PseudoNode</code> | The node to add |
683
+
684
+ <a name="NodeService+cloneShallow"></a>
685
+
686
+ ### textService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
687
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
688
+ Kinds of node which are made with arguments override this to give them.
689
+
690
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
691
+ **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
692
+ <a name="NodeService+equalsShallow"></a>
693
+
694
+ ### textService.equalsShallow(other) ⇒ <code>boolean</code>
695
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
696
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
697
+
698
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
699
+ **Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
700
+
701
+ | Param | Type | Description |
702
+ | --- | --- | --- |
703
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
704
+
705
+ <a name="NodeService+childInserted"></a>
706
+
707
+ ### textService.childInserted(child)
708
+ Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
709
+ (for example elements applying default events) can do so.
710
+
711
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
712
+ **Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
713
+
714
+ | Param | Type | Description |
715
+ | --- | --- | --- |
716
+ | child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
717
+
718
+ <a name="NodeService+cloneNode"></a>
719
+
720
+ ### textService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
721
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
722
+ too, all the way down.
723
+
724
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
725
+ **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
726
+
727
+ | Param | Type | Default | Description |
728
+ | --- | --- | --- | --- |
729
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
730
+
731
+ <a name="NodeService+compareDocumentPosition"></a>
732
+
733
+ ### textService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
734
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
735
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
736
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
737
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
738
+
739
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
740
+ **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
741
+
742
+ | Param | Type | Description |
743
+ | --- | --- | --- |
744
+ | otherNode | <code>PseudoNode</code> | The node to locate |
745
+
746
+ <a name="NodeService+contains"></a>
747
+
748
+ ### textService.contains(otherNode) ⇒ <code>boolean</code>
749
+ Check whether a node is this node or one of its descendants.
750
+
751
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
752
+ **Overrides**: [<code>contains</code>](#NodeService+contains)
753
+
754
+ | Param | Type | Description |
755
+ | --- | --- | --- |
756
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
757
+
758
+ <a name="NodeService+insertBefore"></a>
759
+
760
+ ### textService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
761
+ 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
762
+ already in a tree is moved, and the children of a document fragment are moved in order.
763
+
764
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
765
+ **Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
766
+ **Returns**: <code>PseudoNode</code> - The inserted node
767
+ **Throws**:
768
+
769
+ - <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
770
+
771
+
772
+ | Param | Type | Default | Description |
773
+ | --- | --- | --- | --- |
774
+ | newNode | <code>PseudoNode</code> | | The node to insert |
775
+ | [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
776
+
777
+ <a name="NodeService+isEqualNode"></a>
778
+
779
+ ### textService.isEqualNode(otherNode) ⇒ <code>boolean</code>
780
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
781
+ needs the same attributes), and children which are equal in the same order.
782
+
783
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
784
+ **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
785
+
786
+ | Param | Type | Description |
787
+ | --- | --- | --- |
788
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
789
+
790
+ <a name="NodeService+normalize"></a>
791
+
792
+ ### textService.normalize()
793
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
794
+
795
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
796
+ **Overrides**: [<code>normalize</code>](#NodeService+normalize)
797
+ <a name="NodeService+removeChild"></a>
798
+
799
+ ### textService.removeChild(childElement) ⇒ <code>PseudoNode</code>
800
+ Remove a child from this node, it no longer has a parent or siblings afterwards.
801
+
802
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
803
+ **Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
804
+ **Returns**: <code>PseudoNode</code> - The removed node
805
+ **Throws**:
806
+
807
+ - <code>Error</code> When the node is not a child of this node
808
+
809
+
810
+ | Param | Type | Description |
811
+ | --- | --- | --- |
812
+ | childElement | <code>PseudoNode</code> | The child node to remove |
813
+
814
+ <a name="NodeService+replaceChild"></a>
815
+
816
+ ### textService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
817
+ Replace a child of this node with another node (which is moved if it is already in a tree).
818
+
819
+ **Kind**: instance method of [<code>TextService</code>](#TextService)
820
+ **Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
821
+ **Returns**: <code>PseudoNode</code> - The replaced node
822
+ **Throws**:
823
+
824
+ - <code>Error</code> When the old node is not a child of this node
825
+
826
+
827
+ | Param | Type | Description |
828
+ | --- | --- | --- |
829
+ | newChild | <code>PseudoNode</code> | The node which takes the place |
830
+ | oldChild | <code>PseudoNode</code> | The child of this node to replace |
831
+
832
+ <a name="CommentService"></a>
833
+
834
+ ## CommentService ⇐ [<code>NodeService</code>](#NodeService)
835
+ Simulate the behaviour of the Comment Class when there is no DOM available: a note in the markup which is not shown.
836
+
837
+ **Kind**: global class
838
+ **Extends**: [<code>NodeService</code>](#NodeService)
839
+ **Author**: Joshua Heagle <joshuaheagle@gmail.com>
840
+ **Properties**
841
+
842
+ | Name | Type | Description |
843
+ | --- | --- | --- |
844
+ | data | <code>string</code> | The comment |
845
+ | length | <code>number</code> | How many characters there are |
846
+
847
+
848
+ * [CommentService](#CommentService) ⇐ [<code>NodeService</code>](#NodeService)
849
+ * [new CommentService([data])](#new_CommentService_new)
850
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
851
+ * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
852
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
853
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
854
+ * [.childInserted(child)](#NodeService+childInserted)
855
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
856
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
857
+ * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
858
+ * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
859
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
860
+ * [.normalize()](#NodeService+normalize)
861
+ * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
862
+ * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
863
+
864
+ <a name="new_CommentService_new"></a>
865
+
866
+ ### new CommentService([data])
867
+
868
+ | Param | Type | Default | Description |
869
+ | --- | --- | --- | --- |
870
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The comment |
871
+
872
+ <a name="NodeService+acceptsChildren"></a>
873
+
874
+ ### commentService.acceptsChildren ⇒ <code>boolean</code>
875
+ Whether this kind of node can have children (text, comments and attributes cannot).
876
+
877
+ **Kind**: instance property of [<code>CommentService</code>](#CommentService)
878
+ **Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
879
+ <a name="NodeService+appendChild"></a>
880
+
881
+ ### commentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
882
+ Add a node as the last child of this node (a node which is already in a tree is moved).
883
+
884
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
885
+ **Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
886
+ **Returns**: <code>PseudoNode</code> - The added node
887
+
888
+ | Param | Type | Description |
889
+ | --- | --- | --- |
890
+ | childNode | <code>PseudoNode</code> | The node to add |
891
+
892
+ <a name="NodeService+cloneShallow"></a>
893
+
894
+ ### commentService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
895
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
896
+ Kinds of node which are made with arguments override this to give them.
897
+
898
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
899
+ **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
900
+ <a name="NodeService+equalsShallow"></a>
901
+
902
+ ### commentService.equalsShallow(other) ⇒ <code>boolean</code>
903
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
904
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
905
+
906
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
907
+ **Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
908
+
909
+ | Param | Type | Description |
910
+ | --- | --- | --- |
911
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
912
+
913
+ <a name="NodeService+childInserted"></a>
914
+
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.
918
+
919
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
920
+ **Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
921
+
922
+ | Param | Type | Description |
923
+ | --- | --- | --- |
924
+ | child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
925
+
926
+ <a name="NodeService+cloneNode"></a>
927
+
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.
931
+
932
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
933
+ **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
934
+
935
+ | Param | Type | Default | Description |
936
+ | --- | --- | --- | --- |
937
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
938
+
939
+ <a name="NodeService+compareDocumentPosition"></a>
940
+
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.
946
+
947
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
948
+ **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
949
+
950
+ | Param | Type | Description |
951
+ | --- | --- | --- |
952
+ | otherNode | <code>PseudoNode</code> | The node to locate |
953
+
954
+ <a name="NodeService+contains"></a>
955
+
956
+ ### commentService.contains(otherNode) ⇒ <code>boolean</code>
957
+ Check whether a node is this node or one of its descendants.
958
+
959
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
960
+ **Overrides**: [<code>contains</code>](#NodeService+contains)
961
+
962
+ | Param | Type | Description |
963
+ | --- | --- | --- |
964
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
965
+
966
+ <a name="NodeService+insertBefore"></a>
967
+
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.
971
+
972
+ **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
+
979
+
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 |
984
+
985
+ <a name="NodeService+isEqualNode"></a>
986
+
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.
990
+
991
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
992
+ **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
993
+
994
+ | Param | Type | Description |
995
+ | --- | --- | --- |
996
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
997
+
998
+ <a name="NodeService+normalize"></a>
999
+
1000
+ ### commentService.normalize()
1001
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
1002
+
1003
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1004
+ **Overrides**: [<code>normalize</code>](#NodeService+normalize)
1005
+ <a name="NodeService+removeChild"></a>
1006
+
1007
+ ### commentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
1008
+ Remove a child from this node, it no longer has a parent or siblings afterwards.
1009
+
1010
+ **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
1016
+
1017
+
1018
+ | Param | Type | Description |
1019
+ | --- | --- | --- |
1020
+ | childElement | <code>PseudoNode</code> | The child node to remove |
1021
+
1022
+ <a name="NodeService+replaceChild"></a>
1023
+
1024
+ ### commentService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
1025
+ Replace a child of this node with another node (which is moved if it is already in a tree).
1026
+
1027
+ **Kind**: instance method of [<code>CommentService</code>](#CommentService)
1028
+ **Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
1029
+ **Returns**: <code>PseudoNode</code> - The replaced node
1030
+ **Throws**:
1031
+
1032
+ - <code>Error</code> When the old node is not a child of this node
1033
+
1034
+
542
1035
  | Param | Type | Description |
543
1036
  | --- | --- | --- |
544
1037
  | newChild | <code>PseudoNode</code> | The node which takes the place |
@@ -1173,6 +1666,9 @@ Simulate the behaviour of the Element Class when there is no DOM available.
1173
1666
 
1174
1667
  * [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
1175
1668
  * [new ElementService([settings])](#new_ElementService_new)
1669
+ * [.currentAttributes()](#ElementService+currentAttributes) ⇒ <code>Array.&lt;{name: string, value: \*}&gt;</code>
1670
+ * [.cloneShallow()](#ElementService+cloneShallow) ⇒ [<code>ElementService</code>](#ElementService)
1671
+ * [.equalsShallow(other)](#ElementService+equalsShallow) ⇒ <code>boolean</code>
1176
1672
  * [.applyDefaultEvent()](#ElementService+applyDefaultEvent) ⇒ <code>function</code>
1177
1673
  * [.childInserted(child)](#ElementService+childInserted)
1178
1674
  * [.hasAttribute(attributeName)](#ElementService+hasAttribute) ⇒ <code>boolean</code>
@@ -1192,6 +1688,32 @@ Simulate the behaviour of the Element Class when there is no DOM available.
1192
1688
  | [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The node to add this element to as its last child |
1193
1689
  | [settings.children] | <code>Array.&lt;PseudoNode&gt;</code> | <code>[]</code> | The nodes to start as children |
1194
1690
 
1691
+ <a name="ElementService+currentAttributes"></a>
1692
+
1693
+ ### elementService.currentAttributes() ⇒ <code>Array.&lt;{name: string, value: \*}&gt;</code>
1694
+ The attributes with the values they have now: the ones which are also properties (className, id, style, ...) can
1695
+ have been changed through the property, which does not change the stored list.
1696
+
1697
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
1698
+ <a name="ElementService+cloneShallow"></a>
1699
+
1700
+ ### elementService.cloneShallow() ⇒ [<code>ElementService</code>](#ElementService)
1701
+ A copy of this element without its children: the same tag and attributes (the values which are objects, such as
1702
+ style, are copied too rather than shared), but not its parent or listeners.
1703
+
1704
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
1705
+ <a name="ElementService+equalsShallow"></a>
1706
+
1707
+ ### elementService.equalsShallow(other) ⇒ <code>boolean</code>
1708
+ Elements are equal when they have the same tag and the same attributes (in any order), which is what isEqualNode
1709
+ checks before it compares the children.
1710
+
1711
+ **Kind**: instance method of [<code>ElementService</code>](#ElementService)
1712
+
1713
+ | Param | Type | Description |
1714
+ | --- | --- | --- |
1715
+ | other | [<code>NodeService</code>](#NodeService) | The element to compare with |
1716
+
1195
1717
  <a name="ElementService+applyDefaultEvent"></a>
1196
1718
 
1197
1719
  ### elementService.applyDefaultEvent() ⇒ <code>function</code>
@@ -1265,16 +1787,26 @@ Simulate the behaviour of the Document Class when there is no DOM available.
1265
1787
  **Author**: Joshua Heagle <joshuaheagle@gmail.com>
1266
1788
 
1267
1789
  * [DocumentService](#DocumentService) ⇐ [<code>NodeService</code>](#NodeService)
1790
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
1268
1791
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
1792
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
1793
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1269
1794
  * [.childInserted(child)](#NodeService+childInserted)
1270
- * [.cloneNode()](#NodeService+cloneNode)
1271
- * [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
1795
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
1796
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
1272
1797
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
1273
1798
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
1274
- * [.isEqualNode()](#NodeService+isEqualNode)
1799
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
1800
+ * [.normalize()](#NodeService+normalize)
1275
1801
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
1276
1802
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
1277
1803
 
1804
+ <a name="NodeService+acceptsChildren"></a>
1805
+
1806
+ ### documentService.acceptsChildren ⇒ <code>boolean</code>
1807
+ Whether this kind of node can have children (text, comments and attributes cannot).
1808
+
1809
+ **Kind**: instance property of [<code>DocumentService</code>](#DocumentService)
1278
1810
  <a name="NodeService+appendChild"></a>
1279
1811
 
1280
1812
  ### documentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -1287,6 +1819,25 @@ Add a node as the last child of this node (a node which is already in a tree is
1287
1819
  | --- | --- | --- |
1288
1820
  | childNode | <code>PseudoNode</code> | The node to add |
1289
1821
 
1822
+ <a name="NodeService+cloneShallow"></a>
1823
+
1824
+ ### documentService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
1825
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
1826
+ Kinds of node which are made with arguments override this to give them.
1827
+
1828
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1829
+ <a name="NodeService+equalsShallow"></a>
1830
+
1831
+ ### documentService.equalsShallow(other) ⇒ <code>boolean</code>
1832
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
1833
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
1834
+
1835
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1836
+
1837
+ | Param | Type | Description |
1838
+ | --- | --- | --- |
1839
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
1840
+
1290
1841
  <a name="NodeService+childInserted"></a>
1291
1842
 
1292
1843
  ### documentService.childInserted(child)
@@ -1301,23 +1852,29 @@ Called each time a node has been inserted as a child of this node, so that nodes
1301
1852
 
1302
1853
  <a name="NodeService+cloneNode"></a>
1303
1854
 
1304
- ### documentService.cloneNode()
1305
- Not implemented yet.
1855
+ ### documentService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
1856
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
1857
+ too, all the way down.
1306
1858
 
1307
1859
  **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1308
- **Throws**:
1309
1860
 
1310
- - <code>Error</code>
1861
+ | Param | Type | Default | Description |
1862
+ | --- | --- | --- | --- |
1863
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1311
1864
 
1312
1865
  <a name="NodeService+compareDocumentPosition"></a>
1313
1866
 
1314
- ### documentService.compareDocumentPosition()
1315
- Not implemented yet.
1867
+ ### documentService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
1868
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
1869
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
1870
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
1871
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
1316
1872
 
1317
1873
  **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1318
- **Throws**:
1319
1874
 
1320
- - <code>Error</code>
1875
+ | Param | Type | Description |
1876
+ | --- | --- | --- |
1877
+ | otherNode | <code>PseudoNode</code> | The node to locate |
1321
1878
 
1322
1879
  <a name="NodeService+contains"></a>
1323
1880
 
@@ -1350,14 +1907,22 @@ already in a tree is moved, and the children of a document fragment are moved in
1350
1907
 
1351
1908
  <a name="NodeService+isEqualNode"></a>
1352
1909
 
1353
- ### documentService.isEqualNode()
1354
- Not implemented yet.
1910
+ ### documentService.isEqualNode(otherNode) ⇒ <code>boolean</code>
1911
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
1912
+ needs the same attributes), and children which are equal in the same order.
1355
1913
 
1356
1914
  **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1357
- **Throws**:
1358
1915
 
1359
- - <code>Error</code>
1916
+ | Param | Type | Description |
1917
+ | --- | --- | --- |
1918
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
1919
+
1920
+ <a name="NodeService+normalize"></a>
1921
+
1922
+ ### documentService.normalize()
1923
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
1360
1924
 
1925
+ **Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
1361
1926
  <a name="NodeService+removeChild"></a>
1362
1927
 
1363
1928
  ### documentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
@@ -1402,16 +1967,26 @@ not part of a tree, when it is inserted its children are moved into the tree ins
1402
1967
  **Author**: Joshua Heagle <joshuaheagle@gmail.com>
1403
1968
 
1404
1969
  * [DocumentFragmentService](#DocumentFragmentService) ⇐ [<code>NodeService</code>](#NodeService)
1970
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
1405
1971
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
1972
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
1973
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1406
1974
  * [.childInserted(child)](#NodeService+childInserted)
1407
- * [.cloneNode()](#NodeService+cloneNode)
1408
- * [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
1975
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
1976
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
1409
1977
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
1410
1978
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
1411
- * [.isEqualNode()](#NodeService+isEqualNode)
1979
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
1980
+ * [.normalize()](#NodeService+normalize)
1412
1981
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
1413
1982
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
1414
1983
 
1984
+ <a name="NodeService+acceptsChildren"></a>
1985
+
1986
+ ### documentFragmentService.acceptsChildren ⇒ <code>boolean</code>
1987
+ Whether this kind of node can have children (text, comments and attributes cannot).
1988
+
1989
+ **Kind**: instance property of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1415
1990
  <a name="NodeService+appendChild"></a>
1416
1991
 
1417
1992
  ### documentFragmentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -1424,6 +1999,25 @@ Add a node as the last child of this node (a node which is already in a tree is
1424
1999
  | --- | --- | --- |
1425
2000
  | childNode | <code>PseudoNode</code> | The node to add |
1426
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.
2007
+
2008
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2009
+ <a name="NodeService+equalsShallow"></a>
2010
+
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.
2014
+
2015
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2016
+
2017
+ | Param | Type | Description |
2018
+ | --- | --- | --- |
2019
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2020
+
1427
2021
  <a name="NodeService+childInserted"></a>
1428
2022
 
1429
2023
  ### documentFragmentService.childInserted(child)
@@ -1438,23 +2032,29 @@ Called each time a node has been inserted as a child of this node, so that nodes
1438
2032
 
1439
2033
  <a name="NodeService+cloneNode"></a>
1440
2034
 
1441
- ### documentFragmentService.cloneNode()
1442
- Not implemented yet.
2035
+ ### documentFragmentService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
2036
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
2037
+ too, all the way down.
1443
2038
 
1444
2039
  **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1445
- **Throws**:
1446
2040
 
1447
- - <code>Error</code>
2041
+ | Param | Type | Default | Description |
2042
+ | --- | --- | --- | --- |
2043
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1448
2044
 
1449
2045
  <a name="NodeService+compareDocumentPosition"></a>
1450
2046
 
1451
- ### documentFragmentService.compareDocumentPosition()
1452
- Not implemented yet.
2047
+ ### documentFragmentService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
2048
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
2049
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
2050
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
2051
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
1453
2052
 
1454
2053
  **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1455
- **Throws**:
1456
2054
 
1457
- - <code>Error</code>
2055
+ | Param | Type | Description |
2056
+ | --- | --- | --- |
2057
+ | otherNode | <code>PseudoNode</code> | The node to locate |
1458
2058
 
1459
2059
  <a name="NodeService+contains"></a>
1460
2060
 
@@ -1487,14 +2087,22 @@ already in a tree is moved, and the children of a document fragment are moved in
1487
2087
 
1488
2088
  <a name="NodeService+isEqualNode"></a>
1489
2089
 
1490
- ### documentFragmentService.isEqualNode()
1491
- Not implemented yet.
2090
+ ### documentFragmentService.isEqualNode(otherNode) ⇒ <code>boolean</code>
2091
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
2092
+ needs the same attributes), and children which are equal in the same order.
1492
2093
 
1493
2094
  **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1494
- **Throws**:
1495
2095
 
1496
- - <code>Error</code>
2096
+ | Param | Type | Description |
2097
+ | --- | --- | --- |
2098
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
2099
+
2100
+ <a name="NodeService+normalize"></a>
1497
2101
 
2102
+ ### documentFragmentService.normalize()
2103
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
2104
+
2105
+ **Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
1498
2106
  <a name="NodeService+removeChild"></a>
1499
2107
 
1500
2108
  ### documentFragmentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
@@ -1624,13 +2232,17 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
1624
2232
 
1625
2233
  * [AttrService](#AttrService) ⇐ [<code>NodeService</code>](#NodeService)
1626
2234
  * [new AttrService(name, [value], [ownerElement], [namespaceURI], [prefix])](#new_AttrService_new)
2235
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
1627
2236
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2237
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2238
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1628
2239
  * [.childInserted(child)](#NodeService+childInserted)
1629
- * [.cloneNode()](#NodeService+cloneNode)
1630
- * [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
2240
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2241
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
1631
2242
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
1632
2243
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
1633
- * [.isEqualNode()](#NodeService+isEqualNode)
2244
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
2245
+ * [.normalize()](#NodeService+normalize)
1634
2246
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
1635
2247
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
1636
2248
 
@@ -1646,6 +2258,13 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
1646
2258
  | [namespaceURI] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The namespace of the attribute |
1647
2259
  | [prefix] | <code>string</code> \| <code>null</code> | <code>null</code> | The namespace prefix of the attribute |
1648
2260
 
2261
+ <a name="NodeService+acceptsChildren"></a>
2262
+
2263
+ ### attrService.acceptsChildren ⇒ <code>boolean</code>
2264
+ Whether this kind of node can have children (text, comments and attributes cannot).
2265
+
2266
+ **Kind**: instance property of [<code>AttrService</code>](#AttrService)
2267
+ **Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
1649
2268
  <a name="NodeService+appendChild"></a>
1650
2269
 
1651
2270
  ### attrService.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -1659,6 +2278,27 @@ Add a node as the last child of this node (a node which is already in a tree is
1659
2278
  | --- | --- | --- |
1660
2279
  | childNode | <code>PseudoNode</code> | The node to add |
1661
2280
 
2281
+ <a name="NodeService+cloneShallow"></a>
2282
+
2283
+ ### attrService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
2284
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
2285
+ Kinds of node which are made with arguments override this to give them.
2286
+
2287
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
2288
+ **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
2289
+ <a name="NodeService+equalsShallow"></a>
2290
+
2291
+ ### attrService.equalsShallow(other) ⇒ <code>boolean</code>
2292
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
2293
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
2294
+
2295
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
2296
+ **Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
2297
+
2298
+ | Param | Type | Description |
2299
+ | --- | --- | --- |
2300
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2301
+
1662
2302
  <a name="NodeService+childInserted"></a>
1663
2303
 
1664
2304
  ### attrService.childInserted(child)
@@ -1674,25 +2314,31 @@ Called each time a node has been inserted as a child of this node, so that nodes
1674
2314
 
1675
2315
  <a name="NodeService+cloneNode"></a>
1676
2316
 
1677
- ### attrService.cloneNode()
1678
- Not implemented yet.
2317
+ ### attrService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
2318
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
2319
+ too, all the way down.
1679
2320
 
1680
2321
  **Kind**: instance method of [<code>AttrService</code>](#AttrService)
1681
2322
  **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
1682
- **Throws**:
1683
2323
 
1684
- - <code>Error</code>
2324
+ | Param | Type | Default | Description |
2325
+ | --- | --- | --- | --- |
2326
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1685
2327
 
1686
2328
  <a name="NodeService+compareDocumentPosition"></a>
1687
2329
 
1688
- ### attrService.compareDocumentPosition()
1689
- Not implemented yet.
2330
+ ### attrService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
2331
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
2332
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
2333
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
2334
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
1690
2335
 
1691
2336
  **Kind**: instance method of [<code>AttrService</code>](#AttrService)
1692
2337
  **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
1693
- **Throws**:
1694
2338
 
1695
- - <code>Error</code>
2339
+ | Param | Type | Description |
2340
+ | --- | --- | --- |
2341
+ | otherNode | <code>PseudoNode</code> | The node to locate |
1696
2342
 
1697
2343
  <a name="NodeService+contains"></a>
1698
2344
 
@@ -1727,15 +2373,24 @@ already in a tree is moved, and the children of a document fragment are moved in
1727
2373
 
1728
2374
  <a name="NodeService+isEqualNode"></a>
1729
2375
 
1730
- ### attrService.isEqualNode()
1731
- Not implemented yet.
2376
+ ### attrService.isEqualNode(otherNode) ⇒ <code>boolean</code>
2377
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
2378
+ needs the same attributes), and children which are equal in the same order.
1732
2379
 
1733
2380
  **Kind**: instance method of [<code>AttrService</code>](#AttrService)
1734
2381
  **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
1735
- **Throws**:
1736
2382
 
1737
- - <code>Error</code>
2383
+ | Param | Type | Description |
2384
+ | --- | --- | --- |
2385
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
1738
2386
 
2387
+ <a name="NodeService+normalize"></a>
2388
+
2389
+ ### attrService.normalize()
2390
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
2391
+
2392
+ **Kind**: instance method of [<code>AttrService</code>](#AttrService)
2393
+ **Overrides**: [<code>normalize</code>](#NodeService+normalize)
1739
2394
  <a name="NodeService+removeChild"></a>
1740
2395
 
1741
2396
  ### attrService.removeChild(childElement) ⇒ <code>PseudoNode</code>
@@ -1783,13 +2438,17 @@ from that linker, and its parent from the linker's parent when it has not been g
1783
2438
 
1784
2439
  * [LinkedNode](#LinkedNode) ⇐ [<code>NodeService</code>](#NodeService)
1785
2440
  * [new LinkedNode(linker, value)](#new_LinkedNode_new)
2441
+ * [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
1786
2442
  * [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
2443
+ * [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
2444
+ * [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
1787
2445
  * [.childInserted(child)](#NodeService+childInserted)
1788
- * [.cloneNode()](#NodeService+cloneNode)
1789
- * [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
2446
+ * [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
2447
+ * [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
1790
2448
  * [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
1791
2449
  * [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
1792
- * [.isEqualNode()](#NodeService+isEqualNode)
2450
+ * [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
2451
+ * [.normalize()](#NodeService+normalize)
1793
2452
  * [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
1794
2453
  * [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
1795
2454
 
@@ -1802,6 +2461,13 @@ from that linker, and its parent from the linker's parent when it has not been g
1802
2461
  | linker | <code>TreeLinker</code> | The linker holding this node |
1803
2462
  | value | <code>string</code> \| <code>null</code> | The value of the node |
1804
2463
 
2464
+ <a name="NodeService+acceptsChildren"></a>
2465
+
2466
+ ### linkedNode.acceptsChildren ⇒ <code>boolean</code>
2467
+ Whether this kind of node can have children (text, comments and attributes cannot).
2468
+
2469
+ **Kind**: instance property of [<code>LinkedNode</code>](#LinkedNode)
2470
+ **Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
1805
2471
  <a name="NodeService+appendChild"></a>
1806
2472
 
1807
2473
  ### linkedNode.appendChild(childNode) ⇒ <code>PseudoNode</code>
@@ -1815,6 +2481,27 @@ Add a node as the last child of this node (a node which is already in a tree is
1815
2481
  | --- | --- | --- |
1816
2482
  | childNode | <code>PseudoNode</code> | The node to add |
1817
2483
 
2484
+ <a name="NodeService+cloneShallow"></a>
2485
+
2486
+ ### linkedNode.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
2487
+ Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
2488
+ Kinds of node which are made with arguments override this to give them.
2489
+
2490
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
2491
+ **Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
2492
+ <a name="NodeService+equalsShallow"></a>
2493
+
2494
+ ### linkedNode.equalsShallow(other) ⇒ <code>boolean</code>
2495
+ Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
2496
+ afterwards. Kinds of node with more to compare (an element has attributes) override this.
2497
+
2498
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
2499
+ **Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
2500
+
2501
+ | Param | Type | Description |
2502
+ | --- | --- | --- |
2503
+ | other | [<code>NodeService</code>](#NodeService) | The node to compare with |
2504
+
1818
2505
  <a name="NodeService+childInserted"></a>
1819
2506
 
1820
2507
  ### linkedNode.childInserted(child)
@@ -1830,25 +2517,31 @@ Called each time a node has been inserted as a child of this node, so that nodes
1830
2517
 
1831
2518
  <a name="NodeService+cloneNode"></a>
1832
2519
 
1833
- ### linkedNode.cloneNode()
1834
- Not implemented yet.
2520
+ ### linkedNode.cloneNode([deep]) ⇒ <code>PseudoNode</code>
2521
+ Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
2522
+ too, all the way down.
1835
2523
 
1836
2524
  **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
1837
2525
  **Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
1838
- **Throws**:
1839
2526
 
1840
- - <code>Error</code>
2527
+ | Param | Type | Default | Description |
2528
+ | --- | --- | --- | --- |
2529
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
1841
2530
 
1842
2531
  <a name="NodeService+compareDocumentPosition"></a>
1843
2532
 
1844
- ### linkedNode.compareDocumentPosition()
1845
- Not implemented yet.
2533
+ ### linkedNode.compareDocumentPosition(otherNode) ⇒ <code>number</code>
2534
+ Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
2535
+ itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
2536
+ CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
2537
+ otherwise PRECEDING or FOLLOWING by their order in the tree.
1846
2538
 
1847
2539
  **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
1848
2540
  **Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
1849
- **Throws**:
1850
2541
 
1851
- - <code>Error</code>
2542
+ | Param | Type | Description |
2543
+ | --- | --- | --- |
2544
+ | otherNode | <code>PseudoNode</code> | The node to locate |
1852
2545
 
1853
2546
  <a name="NodeService+contains"></a>
1854
2547
 
@@ -1883,15 +2576,24 @@ already in a tree is moved, and the children of a document fragment are moved in
1883
2576
 
1884
2577
  <a name="NodeService+isEqualNode"></a>
1885
2578
 
1886
- ### linkedNode.isEqualNode()
1887
- Not implemented yet.
2579
+ ### linkedNode.isEqualNode(otherNode) ⇒ <code>boolean</code>
2580
+ Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
2581
+ needs the same attributes), and children which are equal in the same order.
1888
2582
 
1889
2583
  **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
1890
2584
  **Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
1891
- **Throws**:
1892
2585
 
1893
- - <code>Error</code>
2586
+ | Param | Type | Description |
2587
+ | --- | --- | --- |
2588
+ | otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
1894
2589
 
2590
+ <a name="NodeService+normalize"></a>
2591
+
2592
+ ### linkedNode.normalize()
2593
+ Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
2594
+
2595
+ **Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
2596
+ **Overrides**: [<code>normalize</code>](#NodeService+normalize)
1895
2597
  <a name="NodeService+removeChild"></a>
1896
2598
 
1897
2599
  ### linkedNode.removeChild(childElement) ⇒ <code>PseudoNode</code>
@@ -1981,6 +2683,10 @@ Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
1981
2683
  * [.head](#PseudoHTMLDocument+head) : <code>PseudoHTMLElement</code>
1982
2684
  * [.body](#PseudoHTMLDocument+body) : <code>PseudoHTMLElement</code>
1983
2685
  * [.createElement(tagName)](#PseudoHTMLDocument+createElement) ⇒ <code>PseudoHTMLElement</code>
2686
+ * [.createTextNode([data])](#PseudoHTMLDocument+createTextNode) ⇒ [<code>TextService</code>](#TextService)
2687
+ * [.createComment([data])](#PseudoHTMLDocument+createComment) ⇒ [<code>CommentService</code>](#CommentService)
2688
+ * [.createDocumentFragment()](#PseudoHTMLDocument+createDocumentFragment) ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2689
+ * [.cloneNode([deep])](#PseudoHTMLDocument+cloneNode) ⇒ <code>PseudoNode</code>
1984
2690
 
1985
2691
  <a name="new_PseudoHTMLDocument_new"></a>
1986
2692
 
@@ -2002,7 +2708,7 @@ Create document body element
2002
2708
  <a name="PseudoHTMLDocument+createElement"></a>
2003
2709
 
2004
2710
  ### pseudoHTMLDocument.createElement(tagName) ⇒ <code>PseudoHTMLElement</code>
2005
- Create and return a PseudoHTMLElement, which is not added to the document until it is appended somewhere
2711
+ Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
2006
2712
 
2007
2713
  **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
2008
2714
 
@@ -2010,6 +2716,47 @@ Create and return a PseudoHTMLElement, which is not added to the document until
2010
2716
  | --- | --- | --- | --- |
2011
2717
  | tagName | <code>string</code> | <code>&quot;div&quot;</code> | Tag Name is a string representing the type of Dom element this represents |
2012
2718
 
2719
+ <a name="PseudoHTMLDocument+createTextNode"></a>
2720
+
2721
+ ### pseudoHTMLDocument.createTextNode([data]) ⇒ [<code>TextService</code>](#TextService)
2722
+ Make a text node which belongs to this document.
2723
+
2724
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
2725
+
2726
+ | Param | Type | Default | Description |
2727
+ | --- | --- | --- | --- |
2728
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The text |
2729
+
2730
+ <a name="PseudoHTMLDocument+createComment"></a>
2731
+
2732
+ ### pseudoHTMLDocument.createComment([data]) ⇒ [<code>CommentService</code>](#CommentService)
2733
+ Make a comment which belongs to this document.
2734
+
2735
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
2736
+
2737
+ | Param | Type | Default | Description |
2738
+ | --- | --- | --- | --- |
2739
+ | [data] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The comment |
2740
+
2741
+ <a name="PseudoHTMLDocument+createDocumentFragment"></a>
2742
+
2743
+ ### pseudoHTMLDocument.createDocumentFragment() ⇒ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
2744
+ Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
2745
+ then inserted in one go.
2746
+
2747
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
2748
+ <a name="PseudoHTMLDocument+cloneNode"></a>
2749
+
2750
+ ### pseudoHTMLDocument.cloneNode([deep]) ⇒ <code>PseudoNode</code>
2751
+ Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in the
2752
+ document (a shallow one is an empty document).
2753
+
2754
+ **Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
2755
+
2756
+ | Param | Type | Default | Description |
2757
+ | --- | --- | --- | --- |
2758
+ | [deep] | <code>boolean</code> | <code>false</code> | Copy everything in the document as well |
2759
+
2013
2760
  <a name="PseudoEventListener"></a>
2014
2761
 
2015
2762
  ## PseudoEventListener