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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 "Cannot setRange on immutable List."); | 237 "Cannot setRange on immutable List."); |
238 } | 238 } |
239 void removeRange(int start, int rangeLength) { | 239 void removeRange(int start, int rangeLength) { |
240 throw new UnsupportedError( | 240 throw new UnsupportedError( |
241 "Cannot removeRange on immutable List."); | 241 "Cannot removeRange on immutable List."); |
242 } | 242 } |
243 void insertRange(int start, int rangeLength, [Node initialValue]) { | 243 void insertRange(int start, int rangeLength, [Node initialValue]) { |
244 throw new UnsupportedError( | 244 throw new UnsupportedError( |
245 "Cannot insertRange on immutable List."); | 245 "Cannot insertRange on immutable List."); |
246 } | 246 } |
| 247 List<Node> sublist(int start, [int end]) { |
| 248 if (end == null) end == length; |
| 249 return Lists.getRange(this, start, end, <Node>[]); |
| 250 } |
| 251 |
247 List<Node> getRange(int start, int rangeLength) => | 252 List<Node> getRange(int start, int rangeLength) => |
248 Lists.getRange(this, start, rangeLength, <Node>[]); | 253 sublist(start, start + rangeLength); |
249 | 254 |
250 // -- end List<Node> mixins. | 255 // -- end List<Node> mixins. |
251 | 256 |
252 // TODO(jacobr): benchmark whether this is more efficient or whether caching | 257 // TODO(jacobr): benchmark whether this is more efficient or whether caching |
253 // a local copy of $dom_childNodes is more efficient. | 258 // a local copy of $dom_childNodes is more efficient. |
254 int get length => _this.$dom_childNodes.length; | 259 int get length => _this.$dom_childNodes.length; |
255 | 260 |
256 void set length(int value) { | 261 void set length(int value) { |
257 throw new UnsupportedError( | 262 throw new UnsupportedError( |
258 "Cannot set length on immutable List."); | 263 "Cannot set length on immutable List."); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 330 } |
326 } else { | 331 } else { |
327 for (var node in newNodes) { | 332 for (var node in newNodes) { |
328 this.insertBefore(node, refChild); | 333 this.insertBefore(node, refChild); |
329 } | 334 } |
330 } | 335 } |
331 } | 336 } |
332 | 337 |
333 $!MEMBERS | 338 $!MEMBERS |
334 } | 339 } |
OLD | NEW |