OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 html_common; | 5 part of html_common; |
6 | 6 |
7 /** | 7 /** |
8 * An indexable collection of a node's descendants in the document tree, | 8 * An indexable collection of a node's descendants in the document tree, |
9 * filtered so that only elements are in the collection. | 9 * filtered so that only elements are in the collection. |
10 */ | 10 */ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 final len = this.length; | 42 final len = this.length; |
43 if (newLength >= len) { | 43 if (newLength >= len) { |
44 return; | 44 return; |
45 } else if (newLength < 0) { | 45 } else if (newLength < 0) { |
46 throw new ArgumentError("Invalid list length"); | 46 throw new ArgumentError("Invalid list length"); |
47 } | 47 } |
48 | 48 |
49 removeRange(newLength, len - newLength); | 49 removeRange(newLength, len - newLength); |
50 } | 50 } |
51 | 51 |
52 String join([String separator]) => _filtered.join(separator); | 52 String join([String separator = ""]) => _filtered.join(separator); |
53 | 53 |
54 void add(Element value) { | 54 void add(Element value) { |
55 _childNodes.add(value); | 55 _childNodes.add(value); |
56 } | 56 } |
57 | 57 |
58 void addAll(Iterable<Element> iterable) { | 58 void addAll(Iterable<Element> iterable) { |
59 for (Element element in iterable) { | 59 for (Element element in iterable) { |
60 add(element); | 60 add(element); |
61 } | 61 } |
62 } | 62 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 Element get single => _filtered.single; | 211 Element get single => _filtered.single; |
212 | 212 |
213 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); | 213 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); |
214 | 214 |
215 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); | 215 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); |
216 | 216 |
217 Map<int, Element> asMap() { | 217 Map<int, Element> asMap() { |
218 return IterableMixinWorkaround.asMapList(this); | 218 return IterableMixinWorkaround.asMapList(this); |
219 } | 219 } |
220 } | 220 } |
OLD | NEW |