[AST] Added node.removeChildren()

This commit is contained in:
Patrick Steele-Idem 2017-04-20 13:52:54 -06:00
parent 3964e50c05
commit 340b28804f
2 changed files with 8 additions and 0 deletions

View File

@ -49,6 +49,10 @@ class ArrayContainer extends Container {
} }
} }
removeChildren() {
this.array.length = 0;
}
prependChild(newChild) { prependChild(newChild) {
ok(newChild, '"newChild" is required"'); ok(newChild, '"newChild" is required"');
this.array.unshift(newChild); this.array.unshift(newChild);

View File

@ -143,6 +143,10 @@ class Node {
this.body.moveChildrenTo(targetNode); this.body.moveChildrenTo(targetNode);
} }
removeChildren() {
this.body.removeChildren();
}
forEachNextSibling(callback, thisObj) { forEachNextSibling(callback, thisObj) {
var container = this.container; var container = this.container;