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 html; | 5 part of html; |
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 120 matching lines...) Loading... | |
131 | 131 |
132 dynamic reduce(dynamic initialValue, | 132 dynamic reduce(dynamic initialValue, |
133 dynamic combine(dynamic previousValue, Node element)) { | 133 dynamic combine(dynamic previousValue, Node element)) { |
134 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 134 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
135 } | 135 } |
136 | 136 |
137 String join([String separator]) { | 137 String join([String separator]) { |
138 return IterableMixinWorkaround.joinList(this, separator); | 138 return IterableMixinWorkaround.joinList(this, separator); |
139 } | 139 } |
140 | 140 |
141 List mappedBy(f(Node element)) { | 141 Iterable map(f(Node element)) { |
floitsch
2013/01/30 14:48:44
should return an iterable.
Lasse Reichstein Nielsen
2013/01/31 11:33:49
Done.
| |
142 return IterableMixinWorkaround.mappedByList(this, f); | 142 return IterableMixinWorkaround.mappedByList(this, f); |
143 } | 143 } |
144 | 144 |
145 Iterable mappedBy(f(Node element)) => map(f); | |
146 | |
145 Iterable<Node> where(bool f(Node element)) { | 147 Iterable<Node> where(bool f(Node element)) { |
146 return IterableMixinWorkaround.where(this, f); | 148 return IterableMixinWorkaround.where(this, f); |
147 } | 149 } |
148 | 150 |
149 bool every(bool f(Node element)) => IterableMixinWorkaround.every(this, f); | 151 bool every(bool f(Node element)) => IterableMixinWorkaround.every(this, f); |
150 | 152 |
151 bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f); | 153 bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f); |
152 | 154 |
153 List<Node> toList() => new List<Node>.from(this); | 155 List<Node> toList() => new List<Node>.from(this); |
154 Set<Node> toSet() => new Set<Node>.from(this); | 156 Set<Node> toSet() => new Set<Node>.from(this); |
155 | 157 |
156 bool get isEmpty => this.length == 0; | 158 bool get isEmpty => this.length == 0; |
157 | 159 |
158 // From List<Node>: | 160 // From List<Node>: |
159 | 161 |
160 List<Node> take(int n) { | 162 Iterable<Node> take(int n) { |
161 return IterableMixinWorkaround.takeList(this, n); | 163 return IterableMixinWorkaround.takeList(this, n); |
162 } | 164 } |
163 | 165 |
164 Iterable<Node> takeWhile(bool test(Node value)) { | 166 Iterable<Node> takeWhile(bool test(Node value)) { |
165 return IterableMixinWorkaround.takeWhile(this, test); | 167 return IterableMixinWorkaround.takeWhile(this, test); |
166 } | 168 } |
167 | 169 |
168 List<Node> skip(int n) { | 170 Iterable<Node> skip(int n) { |
169 return IterableMixinWorkaround.skipList(this, n); | 171 return IterableMixinWorkaround.skipList(this, n); |
170 } | 172 } |
171 | 173 |
172 Iterable<Node> skipWhile(bool test(Node value)) { | 174 Iterable<Node> skipWhile(bool test(Node value)) { |
173 return IterableMixinWorkaround.skipWhile(this, test); | 175 return IterableMixinWorkaround.skipWhile(this, test); |
174 } | 176 } |
175 | 177 |
176 Node firstMatching(bool test(Node value), {Node orElse()}) { | 178 Node firstMatching(bool test(Node value), {Node orElse()}) { |
177 return IterableMixinWorkaround.firstMatching(this, test, orElse); | 179 return IterableMixinWorkaround.firstMatching(this, test, orElse); |
178 } | 180 } |
(...skipping 93 matching lines...) Loading... | |
272 final Node parent = this.parentNode; | 274 final Node parent = this.parentNode; |
273 parent.$dom_replaceChild(otherNode, this); | 275 parent.$dom_replaceChild(otherNode, this); |
274 } catch (e) { | 276 } catch (e) { |
275 | 277 |
276 }; | 278 }; |
277 return this; | 279 return this; |
278 } | 280 } |
279 | 281 |
280 $!MEMBERS | 282 $!MEMBERS |
281 } | 283 } |
OLD | NEW |