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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 "Cannot setRange on immutable List."); | 170 "Cannot setRange on immutable List."); |
171 } | 171 } |
172 void removeRange(int start, int rangeLength) { | 172 void removeRange(int start, int rangeLength) { |
173 throw new UnsupportedError( | 173 throw new UnsupportedError( |
174 "Cannot removeRange on immutable List."); | 174 "Cannot removeRange on immutable List."); |
175 } | 175 } |
176 void insertRange(int start, int rangeLength, [Node initialValue]) { | 176 void insertRange(int start, int rangeLength, [Node initialValue]) { |
177 throw new UnsupportedError( | 177 throw new UnsupportedError( |
178 "Cannot insertRange on immutable List."); | 178 "Cannot insertRange on immutable List."); |
179 } | 179 } |
| 180 |
| 181 Iterable<Node> getRange(int start, int end) { |
| 182 throw new UnimplementedError("NodeList.getRange"); |
| 183 } |
| 184 |
180 List<Node> sublist(int start, [int end]) { | 185 List<Node> sublist(int start, [int end]) { |
181 if (end == null) end == length; | 186 if (end == null) end == length; |
182 return Lists.getRange(this, start, end, <Node>[]); | 187 return Lists.getRange(this, start, end, <Node>[]); |
183 } | 188 } |
184 | 189 |
185 List<Node> getRange(int start, int rangeLength) => | |
186 sublist(start, start + rangeLength); | |
187 | |
188 String toString() { | 190 String toString() { |
189 StringBuffer buffer = new StringBuffer('['); | 191 StringBuffer buffer = new StringBuffer('['); |
190 buffer.writeAll(this, ', '); | 192 buffer.writeAll(this, ', '); |
191 buffer.write(']'); | 193 buffer.write(']'); |
192 return buffer.toString(); | 194 return buffer.toString(); |
193 } | 195 } |
194 // -- end List<Node> mixins. | 196 // -- end List<Node> mixins. |
195 | 197 |
196 // TODO(jacobr): benchmark whether this is more efficient or whether caching | 198 // TODO(jacobr): benchmark whether this is more efficient or whether caching |
197 // a local copy of $dom_childNodes is more efficient. | 199 // a local copy of $dom_childNodes is more efficient. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 358 } |
357 | 359 |
358 /** | 360 /** |
359 * Print out a String representation of this Node. | 361 * Print out a String representation of this Node. |
360 */ | 362 */ |
361 String toString() => localName == null ? | 363 String toString() => localName == null ? |
362 (nodeValue == null ? super.toString() : nodeValue) : localName; | 364 (nodeValue == null ? super.toString() : nodeValue) : localName; |
363 | 365 |
364 $!MEMBERS | 366 $!MEMBERS |
365 } | 367 } |
OLD | NEW |