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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 15810006: Reapply 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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 0d36c931f28270df76d6aabcbdbb89b3cd479411..dc4817a6aabad078c0e3470e778f51c4e3a0a757 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7725,6 +7725,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) {
+ Iterable 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();

Powered by Google App Engine
This is Rietveld 408576698