| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 _this.$dom_appendChild(value); | 63 _this.$dom_appendChild(value); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void addLast(Node value) { | 66 void addLast(Node value) { |
| 67 _this.$dom_appendChild(value); | 67 _this.$dom_appendChild(value); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 void addAll(Iterable<Node> iterable) { | 71 void addAll(Iterable<Node> iterable) { |
| 72 if (iterable is _ChildNodeListLazy) { | 72 if (iterable is _ChildNodeListLazy) { |
| 73 if (iterable._this != _this) { | 73 if (!identical(iterable._this, _this)) { |
| 74 // Optimized route for copying between nodes. | 74 // Optimized route for copying between nodes. |
| 75 for (var i = 0, len = iterable.length; i < len; ++i) { | 75 for (var i = 0, len = iterable.length; i < len; ++i) { |
| 76 // Should use $dom_firstChild, Bug 8886. |
| 76 _this.$dom_appendChild(iterable[0]); | 77 _this.$dom_appendChild(iterable[0]); |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 return; | 80 return; |
| 80 } | 81 } |
| 81 for (Node node in iterable) { | 82 for (Node node in iterable) { |
| 82 _this.$dom_appendChild(node); | 83 _this.$dom_appendChild(node); |
| 83 } | 84 } |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 Node replaceWith(Node otherNode) { | 285 Node replaceWith(Node otherNode) { |
| 285 try { | 286 try { |
| 286 final Node parent = this.parentNode; | 287 final Node parent = this.parentNode; |
| 287 parent.$dom_replaceChild(otherNode, this); | 288 parent.$dom_replaceChild(otherNode, this); |
| 288 } catch (e) { | 289 } catch (e) { |
| 289 | 290 |
| 290 }; | 291 }; |
| 291 return this; | 292 return this; |
| 292 } | 293 } |
| 293 | 294 |
| 295 /** |
| 296 * Inserts all of the nodes into this node directly before refChild. |
| 297 * |
| 298 * See also: |
| 299 * |
| 300 * * [insertBefore] |
| 301 */ |
| 302 Node insertAllBefore(Iterable<Node> newNodes, Node refChild) { |
| 303 if (newNodes is _ChildNodeListLazy) { |
| 304 if (identical(newNodes._this, this)) { |
| 305 throw new ArgumentError(newNodes); |
| 306 } |
| 307 |
| 308 // Optimized route for copying between nodes. |
| 309 for (var i = 0, len = newNodes.length; i < len; ++i) { |
| 310 // Should use $dom_firstChild, Bug 8886. |
| 311 this.insertBefore(newNodes[0], refChild); |
| 312 } |
| 313 } else { |
| 314 for (var node in newNodes) { |
| 315 this.insertBefore(node, refChild); |
| 316 } |
| 317 } |
| 318 } |
| 319 |
| 294 $!MEMBERS | 320 $!MEMBERS |
| 295 } | 321 } |
| OLD | NEW |