Chromium Code Reviews| Index: tools/dom/templates/html/impl/impl_Element.darttemplate |
| diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate |
| index 188759ea742f09c3ae992fe2279559f0bc12dab9..7735125288fd3f86f7688a98e646d14ea25a360b 100644 |
| --- a/tools/dom/templates/html/impl/impl_Element.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate |
| @@ -58,6 +58,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 = []; |
|
blois
2013/05/29 23:10:49
var removed; (no need to initialize, or define the
|
| + 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(); |