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

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

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename insertAt to insert.~ 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 /** 7 /**
8 * Lazy implementation of the child nodes of an element that does not request 8 * Lazy implementation of the child nodes of an element that does not request
9 * the actual child nodes of an element until strictly necessary greatly 9 * the actual child nodes of an element until strictly necessary greatly
10 * improving performance for the typical cases where it is not required. 10 * improving performance for the typical cases where it is not required.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 _this.$dom_appendChild(iterable[0]); 76 _this.$dom_appendChild(iterable[0]);
77 } 77 }
78 } 78 }
79 return; 79 return;
80 } 80 }
81 for (Node node in iterable) { 81 for (Node node in iterable) {
82 _this.$dom_appendChild(node); 82 _this.$dom_appendChild(node);
83 } 83 }
84 } 84 }
85 85
86 void insert(int index, Node node) {
87 if (index < 0 || index > length) throw RangeError(index);
88 if (index == length) {
89 _this.$dom_appendChild(node);
90 } else {
91 throw new UnimplementedError("insert on NodeLists");
Lasse Reichstein Nielsen 2013/03/07 09:57:53 And _this.$dom_insertBefore(node, _this.$dom_chil
floitsch 2013/03/07 12:53:53 There is no 'dom_insertBefore' in Dart.
blois 2013/03/08 02:32:40 It's just insertBefore, on node.
92 }
93 }
94
86 Node removeLast() { 95 Node removeLast() {
87 final result = last; 96 final result = last;
88 if (result != null) { 97 if (result != null) {
89 _this.$dom_removeChild(result); 98 _this.$dom_removeChild(result);
90 } 99 }
91 return result; 100 return result;
92 } 101 }
93 102
94 Node removeAt(int index) { 103 Node removeAt(int index) {
95 var result = this[index]; 104 var result = this[index];
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 final Node parent = this.parentNode; 297 final Node parent = this.parentNode;
289 parent.$dom_replaceChild(otherNode, this); 298 parent.$dom_replaceChild(otherNode, this);
290 } catch (e) { 299 } catch (e) {
291 300
292 }; 301 };
293 return this; 302 return this;
294 } 303 }
295 304
296 $!MEMBERS 305 $!MEMBERS
297 } 306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698