Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

Issue 1321613005: Dartium w/ JsInterop enabled (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..67bbdd90f5eb8be54c788a873a17dad7cdd96851 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,8 @@ $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;
- }
+ 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.
*
@@ -329,11 +307,8 @@ $else
*/
@DomName('Node.childNodes')
@DocsEditable()
- @Returns('NodeList')
- @Creates('NodeList')
final List<Node> childNodes;
- $endif
$endif
$!MEMBERS
}

Powered by Google App Engine
This is Rietveld 408576698