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

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

Issue 16171012: Correctly implemented removeWhere and retainWhere for elements in dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
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 021a3ca53e198019a839085e18344c8c674afc6c..7a8c02aa477cfe27d49800654fb404ea7fb8570f 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -7251,6 +7251,24 @@ class _ChildrenElementList extends ListBase<Element> {
throw new UnsupportedError('Cannot sort element lists');
}
+ void removeWhere(bool test(Element element)) {
+ _filter(test, false);
+ }
+
+ void retainWhere(bool test(Element element)) {
+ _filter(test, true);
+ }
+
+ void _filter(bool test(var element), bool retainMatching) {
+ List removed = [];
+ if (retainMatching) {
+ removed = _element.children.where((e) => !test(e));
+ } else {
+ removed = _element.children.where(test);
+ }
+ for (var e in removed) e.remove();
+ }
+
void setRange(int start, int end, Iterable<Element> iterable,
[int skipCount = 0]) {
throw new UnimplementedError();
« 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