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

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

Issue 14425003: Make List.remove return boolean. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 Node removeAt(int index) { 101 Node removeAt(int index) {
102 var result = this[index]; 102 var result = this[index];
103 if (result != null) { 103 if (result != null) {
104 _this.$dom_removeChild(result); 104 _this.$dom_removeChild(result);
105 } 105 }
106 return result; 106 return result;
107 } 107 }
108 108
109 void remove(Object object) { 109 bool remove(Object object) {
110 if (object is! Node) return; 110 if (object is! Node) return false;
111 Node node = object; 111 Node node = object;
112 if (!identical(_this, node.parentNode)) return; 112 if (!identical(_this, node.parentNode)) return false;
113 _this.$dom_removeChild(node); 113 _this.$dom_removeChild(node);
114 return true;
114 } 115 }
115 116
116 void _filter(bool test(Node node), bool removeMatching) { 117 void _filter(bool test(Node node), bool removeMatching) {
117 // This implementation of removeWhere/retainWhere is more efficient 118 // This implementation of removeWhere/retainWhere is more efficient
118 // than the default in ListBase. Child nodes can be removed in constant 119 // than the default in ListBase. Child nodes can be removed in constant
119 // time. 120 // time.
120 Node child = _this.$dom_firstChild; 121 Node child = _this.$dom_firstChild;
121 while (child != null) { 122 while (child != null) {
122 Node nextChild = child.nextSibling; 123 Node nextChild = child.nextSibling;
123 if (test(child) == removeMatching) { 124 if (test(child) == removeMatching) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 361 }
361 362
362 /** 363 /**
363 * Print out a String representation of this Node. 364 * Print out a String representation of this Node.
364 */ 365 */
365 String toString() => localName == null ? 366 String toString() => localName == null ?
366 (nodeValue == null ? super.toString() : nodeValue) : localName; 367 (nodeValue == null ? super.toString() : nodeValue) : localName;
367 368
368 $!MEMBERS 369 $!MEMBERS
369 } 370 }
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