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

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

Issue 12188011: Added expand method to iterables. (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
« no previous file with comments | « tools/dom/src/CssClassSet.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 List mappedBy(f(Element element)) { 68 List mappedBy(f(Element element)) {
69 return IterableMixinWorkaround.mappedByList(this, f); 69 return IterableMixinWorkaround.mappedByList(this, f);
70 } 70 }
71 71
72 Iterable<Element> where(bool f(Element element)) { 72 Iterable<Element> where(bool f(Element element)) {
73 return IterableMixinWorkaround.where(this, f); 73 return IterableMixinWorkaround.where(this, f);
74 } 74 }
75 75
76 Iterable expand(Iterable f(Element element)) {
77 return IterableMixinWorkaround.expand(this, f);
78 }
79
76 bool get isEmpty { 80 bool get isEmpty {
77 return _element.$dom_firstElementChild == null; 81 return _element.$dom_firstElementChild == null;
78 } 82 }
79 83
80 Iterable<Element> take(int n) { 84 Iterable<Element> take(int n) {
81 return IterableMixinWorkaround.takeList(this, n); 85 return IterableMixinWorkaround.takeList(this, n);
82 } 86 }
83 87
84 Iterable<Element> takeWhile(bool test(Element value)) { 88 Iterable<Element> takeWhile(bool test(Element value)) {
85 return IterableMixinWorkaround.takeWhile(this, test); 89 return IterableMixinWorkaround.takeWhile(this, test);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 287 }
284 288
285 List mappedBy(f(Element element)) { 289 List mappedBy(f(Element element)) {
286 return IterableMixinWorkaround.mappedByList(this, f); 290 return IterableMixinWorkaround.mappedByList(this, f);
287 } 291 }
288 292
289 Iterable<Element> where(bool f(Element element)) { 293 Iterable<Element> where(bool f(Element element)) {
290 return IterableMixinWorkaround.where(this, f); 294 return IterableMixinWorkaround.where(this, f);
291 } 295 }
292 296
297 Iterable expand(Iterable f(Element element)) {
298 return IterableMixinWorkaround.expand(this, f);
299 }
300
293 bool every(bool f(Element element)) { 301 bool every(bool f(Element element)) {
294 for(Element element in this) { 302 for(Element element in this) {
295 if (!f(element)) { 303 if (!f(element)) {
296 return false; 304 return false;
297 } 305 }
298 }; 306 };
299 return true; 307 return true;
300 } 308 }
301 309
302 bool any(bool f(Element element)) { 310 bool any(bool f(Element element)) {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 $if DART2JS 1035 $if DART2JS
1028 // Optimization to improve performance until the dart2js compiler inlines this 1036 // Optimization to improve performance until the dart2js compiler inlines this
1029 // method. 1037 // method.
1030 static dynamic createElement_tag(String tag) => 1038 static dynamic createElement_tag(String tag) =>
1031 JS('Element', 'document.createElement(#)', tag); 1039 JS('Element', 'document.createElement(#)', tag);
1032 $else 1040 $else
1033 static Element createElement_tag(String tag) => 1041 static Element createElement_tag(String tag) =>
1034 document.$dom_createElement(tag); 1042 document.$dom_createElement(tag);
1035 $endif 1043 $endif
1036 } 1044 }
OLDNEW
« no previous file with comments | « tools/dom/src/CssClassSet.dart ('k') | tools/dom/templates/html/impl/impl_Node.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698