| OLD | NEW |
| 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 html; | 5 part of html; |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 Element addLast(Element value) => add(value); | 130 Element addLast(Element value) => add(value); |
| 131 | 131 |
| 132 Iterator<Element> get iterator => toList().iterator; | 132 Iterator<Element> get iterator => toList().iterator; |
| 133 | 133 |
| 134 void addAll(Iterable<Element> iterable) { | 134 void addAll(Iterable<Element> iterable) { |
| 135 for (Element element in iterable) { | 135 for (Element element in iterable) { |
| 136 _element.$dom_appendChild(element); | 136 _element.$dom_appendChild(element); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 List<Element> get reversed => |
| 141 new ReversedListView<Element>(this, 0, null); |
| 142 |
| 140 void sort([int compare(Element a, Element b)]) { | 143 void sort([int compare(Element a, Element b)]) { |
| 141 throw new UnsupportedError('TODO(jacobr): should we impl?'); | 144 throw new UnsupportedError('TODO(jacobr): should we impl?'); |
| 142 } | 145 } |
| 143 | 146 |
| 144 dynamic reduce(dynamic initialValue, | 147 dynamic reduce(dynamic initialValue, |
| 145 dynamic combine(dynamic previousValue, Element element)) { | 148 dynamic combine(dynamic previousValue, Element element)) { |
| 146 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 149 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
| 147 } | 150 } |
| 148 | 151 |
| 149 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { | 152 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { |
| 150 throw new UnimplementedError(); | 153 throw new UnimplementedError(); |
| 151 } | 154 } |
| 152 | 155 |
| 153 void remove(Object object) { | 156 void remove(Object object) { |
| 154 if (object is Element) { | 157 if (object is Element) { |
| 155 Element element = object; | 158 Element element = object; |
| 156 if (identical(element.parentNode, this)) { | 159 if (identical(element.parentNode, this)) { |
| 157 _element.$dom_removeChild(element); | 160 _element.$dom_removeChild(element); |
| 158 } | 161 } |
| 159 } | 162 } |
| 160 } | 163 } |
| 161 | 164 |
| 162 void removeAll(Iterable elements) { | 165 void removeAll(Iterable elements) { |
| 163 Collections.removeAll(this, elements); | 166 IterableMixinWorkaround.removeAll(this, elements); |
| 164 } | 167 } |
| 165 | 168 |
| 166 void retainAll(Iterable elements) { | 169 void retainAll(Iterable elements) { |
| 167 Collections.retainAll(this, elements); | 170 IterableMixinWorkaround.retainAll(this, elements); |
| 168 } | 171 } |
| 169 | 172 |
| 170 void removeMatching(bool test(Element element)) { | 173 void removeMatching(bool test(Element element)) { |
| 171 Collections.removeMatching(this, test); | 174 IterableMixinWorkaround.removeMatching(this, test); |
| 172 } | 175 } |
| 173 | 176 |
| 174 void retainMatching(bool test(Element element)) { | 177 void retainMatching(bool test(Element element)) { |
| 175 Collections.retainMatching(this, test); | 178 IterableMixinWorkaround.retainMatching(this, test); |
| 176 } | 179 } |
| 177 | 180 |
| 178 void removeRange(int start, int rangeLength) { | 181 void removeRange(int start, int rangeLength) { |
| 179 throw new UnimplementedError(); | 182 throw new UnimplementedError(); |
| 180 } | 183 } |
| 181 | 184 |
| 182 void insertRange(int start, int rangeLength, [initialValue = null]) { | 185 void insertRange(int start, int rangeLength, [initialValue = null]) { |
| 183 throw new UnimplementedError(); | 186 throw new UnimplementedError(); |
| 184 } | 187 } |
| 185 | 188 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 void addLast(Element value) { | 355 void addLast(Element value) { |
| 353 throw new UnsupportedError(''); | 356 throw new UnsupportedError(''); |
| 354 } | 357 } |
| 355 | 358 |
| 356 Iterator<Element> get iterator => new _FrozenElementListIterator(this); | 359 Iterator<Element> get iterator => new _FrozenElementListIterator(this); |
| 357 | 360 |
| 358 void addAll(Iterable<Element> iterable) { | 361 void addAll(Iterable<Element> iterable) { |
| 359 throw new UnsupportedError(''); | 362 throw new UnsupportedError(''); |
| 360 } | 363 } |
| 361 | 364 |
| 365 List<Element> get reversed => |
| 366 new ReversedListView<Element>(this, 0, null); |
| 367 |
| 362 void sort([int compare(Element a, Element b)]) { | 368 void sort([int compare(Element a, Element b)]) { |
| 363 throw new UnsupportedError(''); | 369 throw new UnsupportedError(''); |
| 364 } | 370 } |
| 365 | 371 |
| 366 dynamic reduce(dynamic initialValue, | 372 dynamic reduce(dynamic initialValue, |
| 367 dynamic combine(dynamic previousValue, Element element)) { | 373 dynamic combine(dynamic previousValue, Element element)) { |
| 368 return IterableMixinWorkaround.reduce(this, initialValue, combine); | 374 return IterableMixinWorkaround.reduce(this, initialValue, combine); |
| 369 } | 375 } |
| 370 | 376 |
| 371 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { | 377 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 $if DART2JS | 1044 $if DART2JS |
| 1039 // Optimization to improve performance until the dart2js compiler inlines this | 1045 // Optimization to improve performance until the dart2js compiler inlines this |
| 1040 // method. | 1046 // method. |
| 1041 static dynamic createElement_tag(String tag) => | 1047 static dynamic createElement_tag(String tag) => |
| 1042 JS('Element', 'document.createElement(#)', tag); | 1048 JS('Element', 'document.createElement(#)', tag); |
| 1043 $else | 1049 $else |
| 1044 static Element createElement_tag(String tag) => | 1050 static Element createElement_tag(String tag) => |
| 1045 document.$dom_createElement(tag); | 1051 document.$dom_createElement(tag); |
| 1046 $endif | 1052 $endif |
| 1047 } | 1053 } |
| OLD | NEW |