diff --git a/lib/core_dom/node_cursor.dart b/lib/core_dom/node_cursor.dart index ae71a7252..ef7523097 100644 --- a/lib/core_dom/node_cursor.dart +++ b/lib/core_dom/node_cursor.dart @@ -2,7 +2,7 @@ part of angular.core.dom_internal; class NodeCursor { final stack = []; - List elements; + List elements; // may be a fixed length list. int index = 0; NodeCursor(this.elements); @@ -29,21 +29,15 @@ class NodeCursor { index = stack.removeLast(); } - void insertAnchorBefore(String name) { - var parent = current.parentNode; - var anchor = new dom.Comment('ANCHOR: $name'); - elements.insert(index++, anchor); - if (parent != null) parent.insertBefore(anchor, current); - } - NodeCursor replaceWithAnchor(String name) { - insertAnchorBefore(name); - var childCursor = remove(); - index--; - return childCursor; + var element = current; + var parent = element.parentNode; + var anchor = new dom.Comment('ANCHOR: $name'); + if (parent != null) parent.insertBefore(anchor, element); + element.remove(); + elements[index] = anchor; + return new NodeCursor([element]); } - NodeCursor remove() => new NodeCursor([elements.removeAt(index)..remove()]); - String toString() => "[NodeCursor: $elements $index]"; }