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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void retainMatching(bool test(Element element)) { | 140 void retainMatching(bool test(Element element)) { |
141 IterableMixinWorkaround.retainMatching(this, test); | 141 IterableMixinWorkaround.retainMatching(this, test); |
142 } | 142 } |
143 | 143 |
144 dynamic reduce(dynamic initialValue, | 144 dynamic reduce(dynamic initialValue, |
145 dynamic combine(dynamic previousValue, Element element)) { | 145 dynamic combine(dynamic previousValue, Element element)) { |
146 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 146 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
147 } | 147 } |
148 bool every(bool f(Element element)) => _filtered.every(f); | 148 bool every(bool f(Element element)) => _filtered.every(f); |
149 bool any(bool f(Element element)) => _filtered.any(f); | 149 bool any(bool f(Element element)) => _filtered.any(f); |
150 List<Element> toList({ bool growable: false }) => | 150 List<Element> toList({ bool growable: true }) => |
151 new List<Element>.from(this, growable: growable); | 151 new List<Element>.from(this, growable: growable); |
152 Set<Element> toSet() => new Set<Element>.from(this); | 152 Set<Element> toSet() => new Set<Element>.from(this); |
153 Element firstMatching(bool test(Element value), {Element orElse()}) { | 153 Element firstMatching(bool test(Element value), {Element orElse()}) { |
154 return _filtered.firstMatching(test, orElse: orElse); | 154 return _filtered.firstMatching(test, orElse: orElse); |
155 } | 155 } |
156 | 156 |
157 Element lastMatching(bool test(Element value), {Element orElse()}) { | 157 Element lastMatching(bool test(Element value), {Element orElse()}) { |
158 return _filtered.lastMatching(test, orElse: orElse); | 158 return _filtered.lastMatching(test, orElse: orElse); |
159 } | 159 } |
160 | 160 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 Element get first => _filtered.first; | 199 Element get first => _filtered.first; |
200 | 200 |
201 Element get last => _filtered.last; | 201 Element get last => _filtered.last; |
202 | 202 |
203 Element get single => _filtered.single; | 203 Element get single => _filtered.single; |
204 | 204 |
205 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); | 205 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); |
206 | 206 |
207 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); | 207 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); |
208 } | 208 } |
OLD | NEW |