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 class FilteredElementList implements ElementList { | 5 class FilteredElementList implements ElementList { |
6 final Node _node; | 6 final Node _node; |
7 final NodeList _childNodes; | 7 final NodeList _childNodes; |
8 | 8 |
9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; | 9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 Element removeLast() { | 85 Element removeLast() { |
86 var last = this.last(); | 86 var last = this.last(); |
87 if (last != null) { | 87 if (last != null) { |
88 last.remove(); | 88 last.remove(); |
89 } | 89 } |
90 return last; | 90 return last; |
91 } | 91 } |
92 | 92 |
| 93 Collection map(f(Element element)) => _filtered.map(f); |
93 Collection<Element> filter(bool f(Element element)) => _filtered.filter(f); | 94 Collection<Element> filter(bool f(Element element)) => _filtered.filter(f); |
94 bool every(bool f(Element element)) => _filtered.every(f); | 95 bool every(bool f(Element element)) => _filtered.every(f); |
95 bool some(bool f(Element element)) => _filtered.some(f); | 96 bool some(bool f(Element element)) => _filtered.some(f); |
96 bool isEmpty() => _filtered.isEmpty(); | 97 bool isEmpty() => _filtered.isEmpty(); |
97 int get length() => _filtered.length; | 98 int get length() => _filtered.length; |
98 Element operator [](int index) => _filtered[index]; | 99 Element operator [](int index) => _filtered[index]; |
99 Iterator<Element> iterator() => _filtered.iterator(); | 100 Iterator<Element> iterator() => _filtered.iterator(); |
100 List<Element> getRange(int start, int length) => | 101 List<Element> getRange(int start, int length) => |
101 _filtered.getRange(start, length); | 102 _filtered.getRange(start, length); |
102 int indexOf(Element element, [int start = 0]) => | 103 int indexOf(Element element, [int start = 0]) => |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 "Title can't be set for document fragments."); | 365 "Title can't be set for document fragments."); |
365 } | 366 } |
366 | 367 |
367 void set webkitdropzone(String value) { | 368 void set webkitdropzone(String value) { |
368 throw new UnsupportedOperationException( | 369 throw new UnsupportedOperationException( |
369 "WebKit drop zone can't be set for document fragments."); | 370 "WebKit drop zone can't be set for document fragments."); |
370 } | 371 } |
371 | 372 |
372 DocumentFragment clone(bool deep) => super.clone(deep); | 373 DocumentFragment clone(bool deep) => super.clone(deep); |
373 } | 374 } |
OLD | NEW |