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 part of html_common; | 5 part of html_common; |
6 | 6 |
7 /** | 7 /** |
8 * An indexable collection of a node's descendants in the document tree, | 8 * An indexable collection of a node's descendants in the document tree, |
9 * filtered so that only elements are in the collection. | 9 * filtered so that only elements are in the collection. |
10 */ | 10 */ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 void addLast(Element value) { | 64 void addLast(Element value) { |
65 add(value); | 65 add(value); |
66 } | 66 } |
67 | 67 |
68 bool contains(Element element) { | 68 bool contains(Element element) { |
69 return element is Element && _childNodes.contains(element); | 69 return element is Element && _childNodes.contains(element); |
70 } | 70 } |
71 | 71 |
72 Iterable<Element> get reversed => _filtered.reversed; | 72 List<Element> get reversed => _filtered.reversed; |
73 | 73 |
74 void sort([int compare(Element a, Element b)]) { | 74 void sort([int compare(Element a, Element b)]) { |
75 throw new UnsupportedError('TODO(jacobr): should we impl?'); | 75 throw new UnsupportedError('TODO(jacobr): should we impl?'); |
76 } | 76 } |
77 | 77 |
78 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { | 78 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { |
79 throw new UnimplementedError(); | 79 throw new UnimplementedError(); |
80 } | 80 } |
81 | 81 |
82 void removeRange(int start, int rangeLength) { | 82 void removeRange(int start, int rangeLength) { |
(...skipping 12 matching lines...) Expand all Loading... |
95 | 95 |
96 Element removeLast() { | 96 Element removeLast() { |
97 final result = this.last; | 97 final result = this.last; |
98 if (result != null) { | 98 if (result != null) { |
99 result.remove(); | 99 result.remove(); |
100 } | 100 } |
101 return result; | 101 return result; |
102 } | 102 } |
103 | 103 |
104 Iterable map(f(Element element)) => _filtered.map(f); | 104 Iterable map(f(Element element)) => _filtered.map(f); |
| 105 List mappedBy(f(Element element)) => _filtered.mappedBy(f); |
105 Iterable<Element> where(bool f(Element element)) => _filtered.where(f); | 106 Iterable<Element> where(bool f(Element element)) => _filtered.where(f); |
106 Iterable expand(Iterable f(Element element)) => _filtered.expand(f); | 107 Iterable expand(Iterable f(Element element)) => _filtered.expand(f); |
107 | 108 |
108 Element removeAt(int index) { | 109 Element removeAt(int index) { |
109 final result = this[index]; | 110 final result = this[index]; |
110 result.remove(); | 111 result.remove(); |
111 return result; | 112 return result; |
112 } | 113 } |
113 | 114 |
114 void remove(Object element) { | 115 void remove(Object element) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Element get first => _filtered.first; | 199 Element get first => _filtered.first; |
199 | 200 |
200 Element get last => _filtered.last; | 201 Element get last => _filtered.last; |
201 | 202 |
202 Element get single => _filtered.single; | 203 Element get single => _filtered.single; |
203 | 204 |
204 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); | 205 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); |
205 | 206 |
206 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); | 207 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); |
207 } | 208 } |
OLD | NEW |