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(nweiz): when all implementations we target have the same name for the | 7 // TODO(nweiz): when all implementations we target have the same name for the |
8 // coreimpl implementation of List<E>, extend that rather than wrapping. | 8 // coreimpl implementation of List<E>, extend that rather than wrapping. |
9 class _ListWrapper<E> implements List<E> { | 9 class _ListWrapper<E> implements List<E> { |
10 List _list; | 10 List _list; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // -- start List<Node> mixins. | 89 // -- start List<Node> mixins. |
90 // Node is the element type. | 90 // Node is the element type. |
91 | 91 |
92 // From Iterable<Node>: | 92 // From Iterable<Node>: |
93 | 93 |
94 Iterator<Node> iterator() { | 94 Iterator<Node> iterator() { |
95 // Note: NodeLists are not fixed size. And most probably length shouldn't | 95 // Note: NodeLists are not fixed size. And most probably length shouldn't |
96 // be cached in both iterator _and_ forEach method. For now caching it | 96 // be cached in both iterator _and_ forEach method. For now caching it |
97 // for consistency. | 97 // for consistency. |
98 return new _FixedSizeListIterator<Node>(this); | 98 return new FixedSizeListIterator<Node>(this); |
99 } | 99 } |
100 | 100 |
101 // From Collection<Node>: | 101 // From Collection<Node>: |
102 | 102 |
103 void add(Node value) { | 103 void add(Node value) { |
104 _parent.$dom_appendChild(value); | 104 _parent.$dom_appendChild(value); |
105 } | 105 } |
106 | 106 |
107 void addLast(Node value) { | 107 void addLast(Node value) { |
108 _parent.$dom_appendChild(value); | 108 _parent.$dom_appendChild(value); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void insertRange(int start, int rangeLength, [Node initialValue]) { | 170 void insertRange(int start, int rangeLength, [Node initialValue]) { |
171 throw new UnsupportedError("Cannot insertRange on immutable List."); | 171 throw new UnsupportedError("Cannot insertRange on immutable List."); |
172 } | 172 } |
173 List<Node> getRange(int start, int rangeLength) => | 173 List<Node> getRange(int start, int rangeLength) => |
174 new _NodeListWrapper(_Lists.getRange(this, start, rangeLength, <Node>[])); | 174 new _NodeListWrapper(_Lists.getRange(this, start, rangeLength, <Node>[])); |
175 | 175 |
176 // -- end List<Node> mixins. | 176 // -- end List<Node> mixins. |
177 | 177 |
178 $!MEMBERS | 178 $!MEMBERS |
179 } | 179 } |
OLD | NEW |