Index: tools/dom/templates/html/impl/impl_Node.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate |
index 47382cf724d4110e45cfa7811a73fdc3a7580536..038891e899baf8a3a78a9d53c741fd9ca470a9d4 100644 |
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate |
@@ -114,7 +114,12 @@ $endif |
bool remove(Object object) { |
if (object is! Node) return false; |
Node node = object; |
+$if JSINTEROP |
+ // We aren't preserving identity of nodes in JSINTEROP mode |
+ if (_this != node.parentNode) return false; |
+$else |
if (!identical(_this, node.parentNode)) return false; |
+$endif |
_this._removeChild(node); |
return true; |
} |
@@ -178,7 +183,7 @@ $endif |
// a local copy of childNodes is more efficient. |
int get length => _this.childNodes.length; |
- void set length(int value) { |
+ set length(int value) { |
throw new UnsupportedError( |
"Cannot set length on immutable List."); |
} |
@@ -201,7 +206,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS |
return new _ChildNodeListLazy(this); |
} |
- void set nodes(Iterable<Node> value) { |
+ set nodes(Iterable<Node> value) { |
// Copy list first since we don't want liveness during iteration. |
// TODO(jacobr): there is a better way to do this. |
List copy = new List.from(value); |
@@ -277,9 +282,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS |
return value == null ? super.toString() : value; |
} |
-$if JSINTEROP |
- List<Node> _childNodes; |
- |
+$if DARTIUM |
/** |
* A list of this node's children. |
* |
@@ -291,33 +294,10 @@ $if JSINTEROP |
*/ |
@DomName('Node.childNodes') |
@DocsEditable() |
- List<Node> get childNodes { |
- if (_childNodes == null) { |
- List<Node> nodes = new List<Node>(); |
- var jsCollection = _blink.BlinkNode.instance.childNodes_Getter_(unwrap_jso(this)); |
- var collectionLen = jsCollection['length']; |
- for (var i = 0; i < collectionLen; i++) { |
- nodes.add(wrap_jso(jsCollection.callMethod('item', [i]))); |
- } |
- _childNodes = nodes; |
- } |
- return _childNodes; |
- } |
+ @Returns('NodeList') |
+ @Creates('NodeList') |
+ List<Node> get childNodes => wrap_jso(_blink.BlinkNode.instance.childNodes_Getter_(unwrap_jso(this))); |
$else |
- $if DARTIUM |
- /** |
- * A list of this node's children. |
- * |
- * ## Other resources |
- * |
- * * [Node.childNodes] |
- * (https://developer.mozilla.org/en-US/docs/Web/API/Node.childNodes) |
- * from MDN. |
- */ |
- @DomName('Node.childNodes') |
- @DocsEditable() |
- List<Node> get childNodes => _blink.BlinkNode.instance.childNodes_Getter_(this); |
- $else |
/** |
* A list of this node's children. |
* |
@@ -333,7 +313,6 @@ $else |
@Creates('NodeList') |
final List<Node> childNodes; |
- $endif |
$endif |
$!MEMBERS |
} |