Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 insertAt(int index, Element element) {
218 if (index < 0 || index > length) throw RangeError(index);
219 if (index == length) {
220 _element.$dom_appendChild(element);
221 } else {
222 throw new UnimplementedError("insertAt on ElementLists");
sra1 2013/03/08 18:56:53 insertBefore the current element at that slot?
floitsch 2013/03/08 23:17:30 Pete told me to keep it unimplemented: "insertBefo
223 }
224 }
225
217 void clear() { 226 void clear() {
218 // It is unclear if we want to keep non element nodes? 227 // It is unclear if we want to keep non element nodes?
219 _element.text = ''; 228 _element.text = '';
220 } 229 }
221 230
222 Element removeAt(int index) { 231 Element removeAt(int index) {
223 final result = this[index]; 232 final result = this[index];
224 if (result != null) { 233 if (result != null) {
225 _element.$dom_removeChild(result); 234 _element.$dom_removeChild(result);
226 } 235 }
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 const ScrollAlignment._internal(this._value); 1124 const ScrollAlignment._internal(this._value);
1116 toString() => 'ScrollAlignment.$_value'; 1125 toString() => 'ScrollAlignment.$_value';
1117 1126
1118 /// Attempt to align the element to the top of the scrollable area. 1127 /// Attempt to align the element to the top of the scrollable area.
1119 static const TOP = const ScrollAlignment._internal('TOP'); 1128 static const TOP = const ScrollAlignment._internal('TOP');
1120 /// Attempt to center the element in the scrollable area. 1129 /// Attempt to center the element in the scrollable area.
1121 static const CENTER = const ScrollAlignment._internal('CENTER'); 1130 static const CENTER = const ScrollAlignment._internal('CENTER');
1122 /// Attempt to align the element to the bottom of the scrollable area. 1131 /// Attempt to align the element to the bottom of the scrollable area.
1123 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1132 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1124 } 1133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698