Index: client/html/src/ElementWrappingImplementation.dart |
diff --git a/client/html/src/ElementWrappingImplementation.dart b/client/html/src/ElementWrappingImplementation.dart |
index 38b82dff028c94a10426cd2c1c21c7c9095387d1..a10b510fb39e63c0527ff1aa4a16d585c90a7799 100644 |
--- a/client/html/src/ElementWrappingImplementation.dart |
+++ b/client/html/src/ElementWrappingImplementation.dart |
@@ -24,29 +24,11 @@ class _ChildrenElementList implements ElementList { |
return LevelDom.wrapElement(_element.firstElementChild); |
} |
- void forEach(void f(Element element)) { |
- for (var element in _childElements) { |
- f(LevelDom.wrapElement(element)); |
- } |
- } |
+ void forEach(void f(Element element)) => _toList().forEach(f); |
- Collection map(f(Element element)) { |
- List output = new List(); |
- forEach((Element element) { |
- output.add(f(element)); |
- }); |
- return output; |
- } |
+ Collection map(f(Element element)) => _toList().map(f); |
- Collection<Element> filter(bool f(Element element)) { |
- List<Element> output = new List<Element>(); |
- forEach((Element element) { |
- if (f(element)) { |
- output.add(element); |
- } |
- }); |
- return output; |
- } |
+ Collection<Element> filter(bool f(Element element)) => _toList().filter(f); |
bool every(bool f(Element element)) { |
for(Element element in this) { |
@@ -67,7 +49,7 @@ class _ChildrenElementList implements ElementList { |
} |
bool isEmpty() { |
- return _element.firstElementChild !== null; |
+ return _element.firstElementChild === null; |
} |
int get length() { |
@@ -110,29 +92,25 @@ class _ChildrenElementList implements ElementList { |
throw 'Not impl yet. todo(jacobr)'; |
} |
- void setRange(int start, int length, List from, [int startFrom = 0]) { |
- throw const NotImplementedException(); |
- } |
+ void setRange(int start, int length, List from, [int startFrom = 0]) => |
+ Lists.setRange(this, start, length, from, startFrom); |
- void removeRange(int start, int length) { |
- throw const NotImplementedException(); |
- } |
+ void removeRange(int start, int length) => |
+ Lists.removeRange(this, start, length, (i) => this[i].remove()); |
void insertRange(int start, int length, [initialValue = null]) { |
throw const NotImplementedException(); |
} |
- List getRange(int start, int length) { |
- throw const NotImplementedException(); |
- } |
+ List getRange(int start, int length) => Lists.getRange(this, start, length); |
int indexOf(Element element, [int start = 0]) { |
- return _Lists.indexOf(this, element, start, this.length); |
+ return Lists.indexOf(this, element, start, this.length); |
} |
int lastIndexOf(Element element, [int start = null]) { |
if (start === null) start = length - 1; |
- return _Lists.lastIndexOf(this, element, start); |
+ return Lists.lastIndexOf(this, element, start); |
} |
void clear() { |