Chromium Code Reviews| 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 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. | 5 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. |
| 6 class _ChildrenElementList implements ElementList { | 6 class _ChildrenElementList implements ElementList { |
| 7 // Raw Element. | 7 // Raw Element. |
| 8 final _element; | 8 final _element; |
| 9 final _childElements; | 9 final _childElements; |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 Element get first() { | 23 Element get first() { |
| 24 return LevelDom.wrapElement(_element.firstElementChild); | 24 return LevelDom.wrapElement(_element.firstElementChild); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void forEach(void f(Element element)) { | 27 void forEach(void f(Element element)) { |
| 28 for (var element in _childElements) { | 28 for (var element in _childElements) { |
| 29 f(LevelDom.wrapElement(element)); | 29 f(LevelDom.wrapElement(element)); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 Collection map(f(Element element)) { | |
| 34 List<Element> output = new List<Element>(); | |
|
Jennifer Messerly
2012/01/05 22:54:21
Is this right? It seems like the type should be Li
| |
| 35 forEach((Element element) { | |
| 36 output.add(f(element)); | |
|
Jennifer Messerly
2012/01/05 22:54:21
nit: indent -2
| |
| 37 }); | |
| 38 return output; | |
| 39 } | |
| 40 | |
| 33 Collection<Element> filter(bool f(Element element)) { | 41 Collection<Element> filter(bool f(Element element)) { |
| 34 List<Element> output = new List<Element>(); | 42 List<Element> output = new List<Element>(); |
| 35 forEach((Element element) { | 43 forEach((Element element) { |
| 36 if (f(element)) { | 44 if (f(element)) { |
| 37 output.add(element); | 45 output.add(element); |
| 38 } | 46 } |
| 39 }); | 47 }); |
| 40 return output; | 48 return output; |
| 41 } | 49 } |
| 42 | 50 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 Element get first() { | 161 Element get first() { |
| 154 return this[0]; | 162 return this[0]; |
| 155 } | 163 } |
| 156 | 164 |
| 157 void forEach(void f(Element element)) { | 165 void forEach(void f(Element element)) { |
| 158 for (var element in _ptr) { | 166 for (var element in _ptr) { |
| 159 f(LevelDom.wrapElement(element)); | 167 f(LevelDom.wrapElement(element)); |
| 160 } | 168 } |
| 161 } | 169 } |
| 162 | 170 |
| 171 Collection map(f(Element element)) { | |
| 172 throw 'Not impl yet. todo(jacobr)'; | |
|
ahe
2012/01/05 22:36:54
Please don't abbreviate and follow TODO convention
Jennifer Messerly
2012/01/05 22:54:21
could also be "throw const NotImplementedException
| |
| 173 } | |
| 174 | |
| 163 Collection<Element> filter(bool f(Element element)) { | 175 Collection<Element> filter(bool f(Element element)) { |
| 164 throw 'Not impl yet. todo(jacobr)'; | 176 throw 'Not impl yet. todo(jacobr)'; |
| 165 } | 177 } |
| 166 | 178 |
| 167 bool every(bool f(Element element)) { | 179 bool every(bool f(Element element)) { |
| 168 throw 'Not impl yet. todo(jacobr)'; | 180 throw 'Not impl yet. todo(jacobr)'; |
| 169 } | 181 } |
| 170 | 182 |
| 171 bool some(bool f(Element element)) { | 183 bool some(bool f(Element element)) { |
| 172 throw 'Not impl yet. todo(jacobr)'; | 184 throw 'Not impl yet. todo(jacobr)'; |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 new Completer<CSSStyleDeclaration>()); | 770 new Completer<CSSStyleDeclaration>()); |
| 759 } | 771 } |
| 760 | 772 |
| 761 ElementEvents get on() { | 773 ElementEvents get on() { |
| 762 if (_on === null) { | 774 if (_on === null) { |
| 763 _on = new ElementEventsImplementation._wrap(_ptr); | 775 _on = new ElementEventsImplementation._wrap(_ptr); |
| 764 } | 776 } |
| 765 return _on; | 777 return _on; |
| 766 } | 778 } |
| 767 } | 779 } |
| OLD | NEW |