Index: sdk/lib/html/html_common/filtered_element_list.dart |
diff --git a/sdk/lib/html/html_common/filtered_element_list.dart b/sdk/lib/html/html_common/filtered_element_list.dart |
index 3514cdc654135ce42502eb59c6f95fe81e9a0355..242da062ca615ee136ab7f6577f99b6aeb35487c 100644 |
--- a/sdk/lib/html/html_common/filtered_element_list.dart |
+++ b/sdk/lib/html/html_common/filtered_element_list.dart |
@@ -28,8 +28,8 @@ class FilteredElementList<T extends Element> extends ListBase<T> |
// |
// TODO(nweiz): we don't always need to create a new list. For example |
// forEach, every, any, ... could directly work on the _childNodes. |
- List<T> get _filtered => |
- new List<T>.from(_childNodes.where((n) => n is Element)); |
+ Iterable<T> get _iterable => _childNodes.where((n) => n is Element); |
+ List<T> get _filtered => new List<T>.from(_iterable, growable: false); |
void forEach(void f(T element)) { |
_filtered.forEach(f); |
@@ -104,11 +104,13 @@ class FilteredElementList<T extends Element> extends ListBase<T> |
} |
void insert(int index, T value) { |
- _childNodes.insert(index, value); |
+ Element element =_iterable.elementAt(index); |
+ element.parentNode.insertBefore(value, element); |
} |
void insertAll(int index, Iterable<T> iterable) { |
- _childNodes.insertAll(index, iterable); |
+ Element element =_iterable.elementAt(index); |
+ element.parentNode.insertAllBefore(iterable, element); |
} |
T removeAt(int index) { |