Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // TODO(jacobr): use _Lists.dart to remove some of the duplicated 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
8 // functionality. 8 // functionality.
9 class _ChildrenElementList implements List { 9 class _ChildrenElementList implements List {
10 // Raw Element. 10 // Raw Element.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return true; 54 return true;
55 } 55 }
56 } 56 }
57 return false; 57 return false;
58 } 58 }
59 59
60 String join([String separator]) { 60 String join([String separator]) {
61 return IterableMixinWorkaround.joinList(this, separator); 61 return IterableMixinWorkaround.joinList(this, separator);
62 } 62 }
63 63
64 List mappedBy(f(Element element)) { 64 Iterable map(f(Element element)) {
floitsch 2013/01/30 14:48:44 should return an Iterable.
Lasse Reichstein Nielsen 2013/01/31 11:33:49 Done.
65 return IterableMixinWorkaround.mappedByList(this, f); 65 return IterableMixinWorkaround.mappedByList(this, f);
66 } 66 }
67 67
68 Iterable mappedBy(f(ELement element)) => map(f);
69
68 Iterable<Element> where(bool f(Element element)) { 70 Iterable<Element> where(bool f(Element element)) {
69 return IterableMixinWorkaround.where(this, f); 71 return IterableMixinWorkaround.where(this, f);
70 } 72 }
71 73
72 bool get isEmpty { 74 bool get isEmpty {
73 return _element.$dom_firstElementChild == null; 75 return _element.$dom_firstElementChild == null;
74 } 76 }
75 77
76 List<Element> take(int n) { 78 Iterable<Element> take(int n) {
77 return IterableMixinWorkaround.takeList(this, n); 79 return IterableMixinWorkaround.takeList(this, n);
78 } 80 }
79 81
80 Iterable<Element> takeWhile(bool test(Element value)) { 82 Iterable<Element> takeWhile(bool test(Element value)) {
81 return IterableMixinWorkaround.takeWhile(this, test); 83 return IterableMixinWorkaround.takeWhile(this, test);
82 } 84 }
83 85
84 List<Element> skip(int n) { 86 Iterable<Element> skip(int n) {
85 return IterableMixinWorkaround.skipList(this, n); 87 return IterableMixinWorkaround.skipList(this, n);
86 } 88 }
87 89
88 Iterable<Element> skipWhile(bool test(Element value)) { 90 Iterable<Element> skipWhile(bool test(Element value)) {
89 return IterableMixinWorkaround.skipWhile(this, test); 91 return IterableMixinWorkaround.skipWhile(this, test);
90 } 92 }
91 93
92 Element firstMatching(bool test(Element value), {Element orElse()}) { 94 Element firstMatching(bool test(Element value), {Element orElse()}) {
93 return IterableMixinWorkaround.firstMatching(this, test, orElse); 95 return IterableMixinWorkaround.firstMatching(this, test, orElse);
94 } 96 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 void forEach(void f(Element element)) { 269 void forEach(void f(Element element)) {
268 for (Element el in this) { 270 for (Element el in this) {
269 f(el); 271 f(el);
270 } 272 }
271 } 273 }
272 274
273 String join([String separator]) { 275 String join([String separator]) {
274 return IterableMixinWorkaround.joinList(this, separator); 276 return IterableMixinWorkaround.joinList(this, separator);
275 } 277 }
276 278
277 List mappedBy(f(Element element)) { 279 Iterable map(f(Element element)) {
floitsch 2013/01/30 14:48:44 should return an Iterable.
Lasse Reichstein Nielsen 2013/01/31 11:33:49 Done.
278 return IterableMixinWorkaround.mappedByList(this, f); 280 return IterableMixinWorkaround.mappedByList(this, f);
279 } 281 }
280 282
283 Iterable mappedBy(f(ELement element)) => map(f);
284
281 Iterable<Element> where(bool f(Element element)) { 285 Iterable<Element> where(bool f(Element element)) {
282 return IterableMixinWorkaround.where(this, f); 286 return IterableMixinWorkaround.where(this, f);
283 } 287 }
284 288
285 bool every(bool f(Element element)) { 289 bool every(bool f(Element element)) {
286 for(Element element in this) { 290 for(Element element in this) {
287 if (!f(element)) { 291 if (!f(element)) {
288 return false; 292 return false;
289 } 293 }
290 }; 294 };
291 return true; 295 return true;
292 } 296 }
293 297
294 bool any(bool f(Element element)) { 298 bool any(bool f(Element element)) {
295 for(Element element in this) { 299 for(Element element in this) {
296 if (f(element)) { 300 if (f(element)) {
297 return true; 301 return true;
298 } 302 }
299 }; 303 };
300 return false; 304 return false;
301 } 305 }
302 306
303 List<Element> toList() => new List<Element>.from(this); 307 List<Element> toList() => new List<Element>.from(this);
304 Set<Element> toSet() => new Set<Element>.from(this); 308 Set<Element> toSet() => new Set<Element>.from(this);
305 309
306 List<Element> take(int n) { 310 Iterable<Element> take(int n) {
307 return IterableMixinWorkaround.takeList(this, n); 311 return IterableMixinWorkaround.takeList(this, n);
308 } 312 }
309 313
310 Iterable<Element> takeWhile(bool test(Element value)) { 314 Iterable<Element> takeWhile(bool test(Element value)) {
311 return IterableMixinWorkaround.takeWhile(this, test); 315 return IterableMixinWorkaround.takeWhile(this, test);
312 } 316 }
313 317
314 List<Element> skip(int n) { 318 Iterable<Element> skip(int n) {
315 return IterableMixinWorkaround.skipList(this, n); 319 return IterableMixinWorkaround.skipList(this, n);
316 } 320 }
317 321
318 Iterable<Element> skipWhile(bool test(Element value)) { 322 Iterable<Element> skipWhile(bool test(Element value)) {
319 return IterableMixinWorkaround.skipWhile(this, test); 323 return IterableMixinWorkaround.skipWhile(this, test);
320 } 324 }
321 325
322 Element firstMatching(bool test(Element value), {Element orElse()}) { 326 Element firstMatching(bool test(Element value), {Element orElse()}) {
323 return IterableMixinWorkaround.firstMatching(this, test, orElse); 327 return IterableMixinWorkaround.firstMatching(this, test, orElse);
324 } 328 }
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 $if DART2JS 1044 $if DART2JS
1041 // Optimization to improve performance until the dart2js compiler inlines this 1045 // Optimization to improve performance until the dart2js compiler inlines this
1042 // method. 1046 // method.
1043 static dynamic createElement_tag(String tag) => 1047 static dynamic createElement_tag(String tag) =>
1044 JS('Element', 'document.createElement(#)', tag); 1048 JS('Element', 'document.createElement(#)', tag);
1045 $else 1049 $else
1046 static Element createElement_tag(String tag) => 1050 static Element createElement_tag(String tag) =>
1047 document.$dom_createElement(tag); 1051 document.$dom_createElement(tag);
1048 $endif 1052 $endif
1049 } 1053 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698