@@ -18,15 +18,15 @@ let a = {foo: 'bar'}; // or `new Whatever()`
1818let b = {foo: ' baz' };
1919let c = {foo: ' qux' };
2020
21- tree .insertBefore (a, b ); // insert a before b
22- tree .insertAfter (c, b ); // insert c after b
21+ tree .insertBefore (b, a ); // insert a before b
22+ tree .insertAfter (b, c ); // insert c after b
2323
24- console .log (tree .next (a) === b);
25- console .log (tree .next (b) === c);
26- console .log (tree .prev (c) === b);
24+ console .log (tree .nextSibling (a) === b);
25+ console .log (tree .nextSibling (b) === c);
26+ console .log (tree .previousSibling (c) === b);
2727
2828tree .remove (b);
29- console .log (tree .next (a) === c);
29+ console .log (tree .nextSibling (a) === c);
3030```
3131
3232A tree:
@@ -40,17 +40,17 @@ let a = {};
4040let b = {};
4141let c = {};
4242
43- tree .insertFirst (a, parent ); // insert a as the first child
44- tree .insertLast (c, parent ); // insert c as the last child
45- tree .insertAfter (b, a ); // insert b after a, it now has the same parent as a
43+ tree .prependChild (parent, a ); // insert a as the first child
44+ tree .appendChild (parent,c ); // insert c as the last child
45+ tree .insertAfter (a, b ); // insert b after a, it now has the same parent as a
4646
47- console .log (tree .first (parent) === a);
48- console .log (tree .next (tree .first (parent)) === b);
49- console .log (tree .last (parent) === c);
47+ console .log (tree .firstChild (parent) === a);
48+ console .log (tree .nextSibling (tree .firstChild (parent)) === b);
49+ console .log (tree .lastChild (parent) === c);
5050
5151let grandparent = {};
52- tree .insertFirst (parent, grandparent );
53- console .log (tree .first (tree .first (grandparent)) === a);
52+ tree .prependChild (grandparent, parent );
53+ console .log (tree .firstChild (tree .firstChild (grandparent)) === a);
5454```
5555
5656See [ api.md] ( api.md ) for more documentation.
0 commit comments