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

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

Issue 11931034: Add methods to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 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 html; 5 part of html;
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 Node removeAt(int index) { 85 Node removeAt(int index) {
86 var result = this[index]; 86 var result = this[index];
87 if (result != null) { 87 if (result != null) {
88 _this.$dom_removeChild(result); 88 _this.$dom_removeChild(result);
89 } 89 }
90 return result; 90 return result;
91 } 91 }
92 92
93 void remove(Object object) {
94 if (object is! Node) return;
95 Node node = object;
96 if (!identical(this, node.parentNode)) return;
97 _this.$dom_removeChild(node);
98 }
99
100 void removeAll(Iterable elements) {
101 IterableMixinWorkaround.removeAll(this, elements);
102 }
103
104 void retainAll(Iterable elements) {
105 IterableMixinWorkaround.retainAll(this, elements);
106 }
107
108 void removeMatching(bool test(Node node)) {
109 IterableMixinWorkaround.removeMatching(this, test);
110 }
111
112 void retainMatching(bool test(Node node)) {
113 IterableMixinWorkaround.retainMatching(this, test);
114 }
115
93 void clear() { 116 void clear() {
94 _this.text = ''; 117 _this.text = '';
95 } 118 }
96 119
97 void operator []=(int index, Node value) { 120 void operator []=(int index, Node value) {
98 _this.$dom_replaceChild(value, this[index]); 121 _this.$dom_replaceChild(value, this[index]);
99 } 122 }
100 123
101 Iterator<Node> get iterator => _this.$dom_childNodes.iterator; 124 Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
102 125
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 final Node parent = this.parentNode; 268 final Node parent = this.parentNode;
246 parent.$dom_replaceChild(otherNode, this); 269 parent.$dom_replaceChild(otherNode, this);
247 } catch (e) { 270 } catch (e) {
248 271
249 }; 272 };
250 return this; 273 return this;
251 } 274 }
252 275
253 $!MEMBERS 276 $!MEMBERS
254 } 277 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | tools/dom/templates/immutable_list_mixin.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698