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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.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, 6 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 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev' hide Symbol; 6 import 'dart:_collection-dev' hide Symbol;
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 7233 matching lines...) Expand 10 before | Expand all | Expand 10 after
7244 7244
7245 for (Element element in iterable) { 7245 for (Element element in iterable) {
7246 _element.append(element); 7246 _element.append(element);
7247 } 7247 }
7248 } 7248 }
7249 7249
7250 void sort([int compare(Element a, Element b)]) { 7250 void sort([int compare(Element a, Element b)]) {
7251 throw new UnsupportedError('Cannot sort element lists'); 7251 throw new UnsupportedError('Cannot sort element lists');
7252 } 7252 }
7253 7253
7254 void removeWhere(bool test(Element element)) {
7255 _filter(test, false);
7256 }
7257
7258 void retainWhere(bool test(Element element)) {
7259 _filter(test, true);
7260 }
7261
7262 void _filter(bool test(var element), bool retainMatching) {
7263 Iterable removed = [];
7264 if (retainMatching) {
7265 removed = _element.children.where((e) => !test(e));
7266 } else {
7267 removed = _element.children.where(test);
7268 }
7269 for (var e in removed) e.remove();
7270 }
7271
7254 void setRange(int start, int end, Iterable<Element> iterable, 7272 void setRange(int start, int end, Iterable<Element> iterable,
7255 [int skipCount = 0]) { 7273 [int skipCount = 0]) {
7256 throw new UnimplementedError(); 7274 throw new UnimplementedError();
7257 } 7275 }
7258 7276
7259 void replaceRange(int start, int end, Iterable<Element> iterable) { 7277 void replaceRange(int start, int end, Iterable<Element> iterable) {
7260 throw new UnimplementedError(); 7278 throw new UnimplementedError();
7261 } 7279 }
7262 7280
7263 void fillRange(int start, int end, [Element fillValue]) { 7281 void fillRange(int start, int end, [Element fillValue]) {
(...skipping 22034 matching lines...) Expand 10 before | Expand all | Expand 10 after
29298 _position = nextPosition; 29316 _position = nextPosition;
29299 return true; 29317 return true;
29300 } 29318 }
29301 _current = null; 29319 _current = null;
29302 _position = _array.length; 29320 _position = _array.length;
29303 return false; 29321 return false;
29304 } 29322 }
29305 29323
29306 T get current => _current; 29324 T get current => _current;
29307 } 29325 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('J')

Powered by Google App Engine
This is Rietveld 408576698