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 $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 int indexOf(Element element, [int start = 0]) { | 208 int indexOf(Element element, [int start = 0]) { |
209 return Lists.indexOf(this, element, start, this.length); | 209 return Lists.indexOf(this, element, start, this.length); |
210 } | 210 } |
211 | 211 |
212 int lastIndexOf(Element element, [int start = null]) { | 212 int lastIndexOf(Element element, [int start = null]) { |
213 if (start == null) start = length - 1; | 213 if (start == null) start = length - 1; |
214 return Lists.lastIndexOf(this, element, start); | 214 return Lists.lastIndexOf(this, element, start); |
215 } | 215 } |
216 | 216 |
| 217 void insert(int index, Element element) { |
| 218 if (index < 0 || index > length) { |
| 219 throw new RangeError.range(index, 0, length); |
| 220 } |
| 221 if (index == length) { |
| 222 _element.$dom_appendChild(element); |
| 223 } else { |
| 224 throw new UnimplementedError("insert on ElementLists"); |
| 225 } |
| 226 } |
| 227 |
217 void clear() { | 228 void clear() { |
218 // It is unclear if we want to keep non element nodes? | 229 // It is unclear if we want to keep non element nodes? |
219 _element.text = ''; | 230 _element.text = ''; |
220 } | 231 } |
221 | 232 |
222 Element removeAt(int index) { | 233 Element removeAt(int index) { |
223 final result = this[index]; | 234 final result = this[index]; |
224 if (result != null) { | 235 if (result != null) { |
225 _element.$dom_removeChild(result); | 236 _element.$dom_removeChild(result); |
226 } | 237 } |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 const ScrollAlignment._internal(this._value); | 1167 const ScrollAlignment._internal(this._value); |
1157 toString() => 'ScrollAlignment.$_value'; | 1168 toString() => 'ScrollAlignment.$_value'; |
1158 | 1169 |
1159 /// Attempt to align the element to the top of the scrollable area. | 1170 /// Attempt to align the element to the top of the scrollable area. |
1160 static const TOP = const ScrollAlignment._internal('TOP'); | 1171 static const TOP = const ScrollAlignment._internal('TOP'); |
1161 /// Attempt to center the element in the scrollable area. | 1172 /// Attempt to center the element in the scrollable area. |
1162 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1173 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1163 /// Attempt to align the element to the bottom of the scrollable area. | 1174 /// Attempt to align the element to the bottom of the scrollable area. |
1164 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1175 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1165 } | 1176 } |
OLD | NEW |