| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // TODO(jacobr): benchmark whether this is more efficient or whether caching | 240 // TODO(jacobr): benchmark whether this is more efficient or whether caching |
| 241 // a local copy of $dom_childNodes is more efficient. | 241 // a local copy of $dom_childNodes is more efficient. |
| 242 int get length => _this.$dom_childNodes.length; | 242 int get length => _this.$dom_childNodes.length; |
| 243 | 243 |
| 244 void set length(int value) { | 244 void set length(int value) { |
| 245 throw new UnsupportedError( | 245 throw new UnsupportedError( |
| 246 "Cannot set length on immutable List."); | 246 "Cannot set length on immutable List."); |
| 247 } | 247 } |
| 248 | 248 |
| 249 Node operator[](int index) => _this.$dom_childNodes[index]; | 249 Node operator[](int index) => _this.$dom_childNodes[index]; |
| 250 |
| 251 Map<int, Node> asMap() => IterableMixinWorkaround.asMapList(this); |
| 250 } | 252 } |
| 251 | 253 |
| 252 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 254 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 253 List<Node> get nodes { | 255 List<Node> get nodes { |
| 254 return new _ChildNodeListLazy(this); | 256 return new _ChildNodeListLazy(this); |
| 255 } | 257 } |
| 256 | 258 |
| 257 void set nodes(Collection<Node> value) { | 259 void set nodes(Collection<Node> value) { |
| 258 // Copy list first since we don't want liveness during iteration. | 260 // Copy list first since we don't want liveness during iteration. |
| 259 // TODO(jacobr): there is a better way to do this. | 261 // TODO(jacobr): there is a better way to do this. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 286 final Node parent = this.parentNode; | 288 final Node parent = this.parentNode; |
| 287 parent.$dom_replaceChild(otherNode, this); | 289 parent.$dom_replaceChild(otherNode, this); |
| 288 } catch (e) { | 290 } catch (e) { |
| 289 | 291 |
| 290 }; | 292 }; |
| 291 return this; | 293 return this; |
| 292 } | 294 } |
| 293 | 295 |
| 294 $!MEMBERS | 296 $!MEMBERS |
| 295 } | 297 } |
| OLD | NEW |