| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Lazy implementation of the child nodes of an element that does not request | 8 * Lazy implementation of the child nodes of an element that does not request |
| 9 * the actual child nodes of an element until strictly necessary greatly | 9 * the actual child nodes of an element until strictly necessary greatly |
| 10 * improving performance for the typical cases where it is not required. | 10 * improving performance for the typical cases where it is not required. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 var result = this[index]; | 107 var result = this[index]; |
| 108 if (result != null) { | 108 if (result != null) { |
| 109 _this._removeChild(result); | 109 _this._removeChild(result); |
| 110 } | 110 } |
| 111 return result; | 111 return result; |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool remove(Object object) { | 114 bool remove(Object object) { |
| 115 if (object is! Node) return false; | 115 if (object is! Node) return false; |
| 116 Node node = object; | 116 Node node = object; |
| 117 $if JSINTEROP |
| 118 // We aren't preserving identity of nodes in JSINTEROP mode |
| 119 if (_this != node.parentNode) return false; |
| 120 $else |
| 117 if (!identical(_this, node.parentNode)) return false; | 121 if (!identical(_this, node.parentNode)) return false; |
| 122 $endif |
| 118 _this._removeChild(node); | 123 _this._removeChild(node); |
| 119 return true; | 124 return true; |
| 120 } | 125 } |
| 121 | 126 |
| 122 void _filter(bool test(Node node), bool removeMatching) { | 127 void _filter(bool test(Node node), bool removeMatching) { |
| 123 // This implementation of removeWhere/retainWhere is more efficient | 128 // This implementation of removeWhere/retainWhere is more efficient |
| 124 // than the default in ListBase. Child nodes can be removed in constant | 129 // than the default in ListBase. Child nodes can be removed in constant |
| 125 // time. | 130 // time. |
| 126 Node child = _this.firstChild; | 131 Node child = _this.firstChild; |
| 127 while (child != null) { | 132 while (child != null) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 */ | 309 */ |
| 305 @DomName('Node.childNodes') | 310 @DomName('Node.childNodes') |
| 306 @DocsEditable() | 311 @DocsEditable() |
| 307 @Returns('NodeList') | 312 @Returns('NodeList') |
| 308 @Creates('NodeList') | 313 @Creates('NodeList') |
| 309 final List<Node> childNodes; | 314 final List<Node> childNodes; |
| 310 | 315 |
| 311 $endif | 316 $endif |
| 312 $!MEMBERS | 317 $!MEMBERS |
| 313 } | 318 } |
| OLD | NEW |