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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 216933005: Speeding up ElementList.clear & NodeList.clear. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Element now matches Node Created 6 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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 654e26f379abf531b8aa2e650286d21d67322202..5348c39ae06b86eff1c9e8fcad15ae0b172820ac 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -8313,8 +8313,7 @@ class _ChildrenElementList extends ListBase<Element>
}
void clear() {
- // It is unclear if we want to keep non element nodes?
- _element.text = '';
+ _element._clearChildren();
}
Element removeAt(int index) {
@@ -19667,7 +19666,7 @@ class _ChildNodeListLazy extends ListBase<Node> implements NodeListWrapper {
}
void clear() {
- _this.text = '';
+ _this._clearChildren();
}
void operator []=(int index, Node value) {
@@ -19789,6 +19788,12 @@ class Node extends EventTarget native "Node" {
}
}
+ void _clearChildren() {
+ while (firstChild != null) {
+ _removeChild(firstChild);
+ }
+ }
+
/**
* Print out a String representation of this Node.
*/
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698