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

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

Issue 1327083002: Revert "Patched in Dartium JsInterop" (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 038891e899baf8a3a78a9d53c741fd9ca470a9d4..47382cf724d4110e45cfa7811a73fdc3a7580536 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -114,12 +114,7 @@ $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;
}
@@ -183,7 +178,7 @@ $endif
// a local copy of childNodes is more efficient.
int get length => _this.childNodes.length;
- set length(int value) {
+ void set length(int value) {
throw new UnsupportedError(
"Cannot set length on immutable List.");
}
@@ -206,7 +201,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
return new _ChildNodeListLazy(this);
}
- set nodes(Iterable<Node> value) {
+ void 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);
@@ -282,7 +277,9 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
return value == null ? super.toString() : value;
}
-$if DARTIUM
+$if JSINTEROP
+ List<Node> _childNodes;
+
/**
* A list of this node's children.
*
@@ -294,10 +291,33 @@ $if DARTIUM
*/
@DomName('Node.childNodes')
@DocsEditable()
- @Returns('NodeList')
- @Creates('NodeList')
- List<Node> get childNodes => wrap_jso(_blink.BlinkNode.instance.childNodes_Getter_(unwrap_jso(this)));
+ 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;
+ }
$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.
*
@@ -313,6 +333,7 @@ $else
@Creates('NodeList')
final List<Node> childNodes;
+ $endif
$endif
$!MEMBERS
}

Powered by Google App Engine
This is Rietveld 408576698