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...) Expand 10 before | Expand all | Expand 10 after 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 Iterable map(f(Node element)) { | |
142 return IterableMixinWorkaround.map(this, f); | |
143 } | |
144 | |
145 List mappedBy(f(Node element)) { | 141 List mappedBy(f(Node element)) { |
146 return IterableMixinWorkaround.mappedByList(this, f); | 142 return IterableMixinWorkaround.mappedByList(this, f); |
147 } | 143 } |
148 | 144 |
149 Iterable<Node> where(bool f(Node element)) { | 145 Iterable<Node> where(bool f(Node element)) { |
150 return IterableMixinWorkaround.where(this, f); | 146 return IterableMixinWorkaround.where(this, f); |
151 } | 147 } |
152 | 148 |
153 bool every(bool f(Node element)) => IterableMixinWorkaround.every(this, f); | 149 bool every(bool f(Node element)) => IterableMixinWorkaround.every(this, f); |
154 | 150 |
155 bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f); | 151 bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f); |
156 | 152 |
157 List<Node> toList() => new List<Node>.from(this); | 153 List<Node> toList() => new List<Node>.from(this); |
158 Set<Node> toSet() => new Set<Node>.from(this); | 154 Set<Node> toSet() => new Set<Node>.from(this); |
159 | 155 |
160 bool get isEmpty => this.length == 0; | 156 bool get isEmpty => this.length == 0; |
161 | 157 |
162 // From List<Node>: | 158 // From List<Node>: |
163 | 159 |
164 Iterable<Node> take(int n) { | 160 List<Node> take(int n) { |
165 return IterableMixinWorkaround.takeList(this, n); | 161 return IterableMixinWorkaround.takeList(this, n); |
166 } | 162 } |
167 | 163 |
168 Iterable<Node> takeWhile(bool test(Node value)) { | 164 Iterable<Node> takeWhile(bool test(Node value)) { |
169 return IterableMixinWorkaround.takeWhile(this, test); | 165 return IterableMixinWorkaround.takeWhile(this, test); |
170 } | 166 } |
171 | 167 |
172 Iterable<Node> skip(int n) { | 168 List<Node> skip(int n) { |
173 return IterableMixinWorkaround.skipList(this, n); | 169 return IterableMixinWorkaround.skipList(this, n); |
174 } | 170 } |
175 | 171 |
176 Iterable<Node> skipWhile(bool test(Node value)) { | 172 Iterable<Node> skipWhile(bool test(Node value)) { |
177 return IterableMixinWorkaround.skipWhile(this, test); | 173 return IterableMixinWorkaround.skipWhile(this, test); |
178 } | 174 } |
179 | 175 |
180 Node firstMatching(bool test(Node value), {Node orElse()}) { | 176 Node firstMatching(bool test(Node value), {Node orElse()}) { |
181 return IterableMixinWorkaround.firstMatching(this, test, orElse); | 177 return IterableMixinWorkaround.firstMatching(this, test, orElse); |
182 } | 178 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 final Node parent = this.parentNode; | 272 final Node parent = this.parentNode; |
277 parent.$dom_replaceChild(otherNode, this); | 273 parent.$dom_replaceChild(otherNode, this); |
278 } catch (e) { | 274 } catch (e) { |
279 | 275 |
280 }; | 276 }; |
281 return this; | 277 return this; |
282 } | 278 } |
283 | 279 |
284 $!MEMBERS | 280 $!MEMBERS |
285 } | 281 } |
OLD | NEW |