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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 92 |
93 Collection<Element> filter(bool f(Element element)) => _filtered.filter(f); | 93 Collection<Element> filter(bool f(Element element)) => _filtered.filter(f); |
94 bool every(bool f(Element element)) => _filtered.every(f); | 94 bool every(bool f(Element element)) => _filtered.every(f); |
95 bool some(bool f(Element element)) => _filtered.some(f); | 95 bool some(bool f(Element element)) => _filtered.some(f); |
96 bool isEmpty() => _filtered.isEmpty(); | 96 bool isEmpty() => _filtered.isEmpty(); |
97 int get length() => _filtered.length; | 97 int get length() => _filtered.length; |
98 Element operator [](int index) => _filtered[index]; | 98 Element operator [](int index) => _filtered[index]; |
99 Iterator<Element> iterator() => _filtered.iterator(); | 99 Iterator<Element> iterator() => _filtered.iterator(); |
100 List<Element> getRange(int start, int length) => | 100 List<Element> getRange(int start, int length) => |
101 _filtered.getRange(start, length); | 101 _filtered.getRange(start, length); |
102 int indexOf(Element element, int startIndex) => | 102 int indexOf(Element element, [int start = 0]) => |
103 _filtered.indexOf(element, startIndex); | 103 _filtered.indexOf(element, start); |
104 int lastIndexOf(Element element, int startIndex) => | 104 |
105 _filtered.lastIndexOf(element, startIndex); | 105 int lastIndexOf(Element element, [int start = null]) { |
srdjan
2011/10/31 18:01:29
WHy not just [int start] (here and everywhere else
ngeoffray
2011/11/01 07:50:44
Last time I checked, not giving a default value fa
| |
106 if (start === null) start = length - 1; | |
107 return _filtered.lastIndexOf(element, start); | |
108 } | |
109 | |
106 Element last() => _filtered.last(); | 110 Element last() => _filtered.last(); |
107 } | 111 } |
108 | 112 |
109 class EmptyStyleDeclaration extends CSSStyleDeclarationWrappingImplementation { | 113 class EmptyStyleDeclaration extends CSSStyleDeclarationWrappingImplementation { |
110 // This can't call super(), since that's a factory constructor | 114 // This can't call super(), since that's a factory constructor |
111 EmptyStyleDeclaration() | 115 EmptyStyleDeclaration() |
112 : super._wrap(dom.document.createElement('div').style); | 116 : super._wrap(dom.document.createElement('div').style); |
113 | 117 |
114 void set cssText(String value) { | 118 void set cssText(String value) { |
115 throw new UnsupportedOperationException( | 119 throw new UnsupportedOperationException( |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 | 359 |
356 void set title(String value) { | 360 void set title(String value) { |
357 throw new UnsupportedOperationException( | 361 throw new UnsupportedOperationException( |
358 "Title can't be set for document fragments."); | 362 "Title can't be set for document fragments."); |
359 } | 363 } |
360 | 364 |
361 void set webkitdropzone(String value) { | 365 void set webkitdropzone(String value) { |
362 throw new UnsupportedOperationException( | 366 throw new UnsupportedOperationException( |
363 "WebKit drop zone can't be set for document fragments."); | 367 "WebKit drop zone can't be set for document fragments."); |
364 } | 368 } |
365 } | 369 } |
OLD | NEW |