Chromium Code Reviews| Index: sdk/lib/html/dart2js/html_dart2js.dart |
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart |
| index f357399bde8768f64f35060be7418ea992ec4866..759c7a8463789b8aad548b6b9ed2df8ebca78d9a 100644 |
| --- a/sdk/lib/html/dart2js/html_dart2js.dart |
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart |
| @@ -6803,6 +6803,20 @@ class DocumentFragment extends Node native "*DocumentFragment" { |
| elements.addAll(copy); |
| } |
| + List<Element> _children; |
|
sra1
2012/11/19 19:34:53
_children needs an annotation:
@Creates('Null')
blois
2012/11/19 21:57:49
Done.
|
| + List<Element> get children { |
| + if (_children == null) { |
| + _children = new FilteredElementList(this); |
| + } |
| + return _children; |
| + } |
| + |
| + void set children(Collection<Element> value) { |
| + final children = this.children; |
|
sra1
2012/11/19 19:34:53
This is not the same set elements
x.children = x.
blois
2012/11/19 21:57:49
Done.
|
| + children.clear(); |
| + children.addAll(value); |
| + } |
| + |
| Element query(String selectors) => $dom_querySelector(selectors); |
| List<Element> queryAll(String selectors) => |
| @@ -7627,10 +7641,21 @@ abstract class Element extends Node implements ElementTraversal native "*Element |
| } |
| /** |
| + * Deprecated, use [children] instead. |
| + */ |
| + List<Element> get elements => new _ChildrenElementList._wrap(this); |
|
sra1
2012/11/19 19:34:53
I would write this as => this.children
blois
2012/11/19 21:57:49
Done.
|
| + |
| + /** |
| * @domName childElementCount, firstElementChild, lastElementChild, |
| * children, Node.nodes.add |
| */ |
| - List<Element> get elements => new _ChildrenElementList._wrap(this); |
| + List<Element> get children => new _ChildrenElementList._wrap(this); |
| + |
| + void set children(Collection<Element> value) { |
| + var children = this.children; |
| + children.clear(); |
| + children.addAll(value); |
| + } |
| Element query(String selectors) => $dom_querySelector(selectors); |
| @@ -7984,15 +8009,15 @@ class _ElementFactoryProvider { |
| temp.innerHTML = html; |
| Element element; |
| - if (temp.elements.length == 1) { |
| - element = temp.elements[0]; |
| - } else if (parentTag == 'html' && temp.elements.length == 2) { |
| + if (temp.children.length == 1) { |
| + element = temp.children[0]; |
| + } else if (parentTag == 'html' && temp.children.length == 2) { |
| // Work around for edge case in WebKit and possibly other browsers where |
| // both body and head elements are created even though the inner html |
| // only contains a head or body element. |
| - element = temp.elements[tag == 'head' ? 0 : 1]; |
| + element = temp.children[tag == 'head' ? 0 : 1]; |
| } else { |
| - throw new ArgumentError('HTML had ${temp.elements.length} ' |
| + throw new ArgumentError('HTML had ${temp.children.length} ' |
| 'top level elements but 1 expected'); |
| } |
| element.remove(); |
| @@ -8962,8 +8987,7 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior |
| num operator[](int index) => JS("num", "#[#]", this, index); |
| - void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<num> mixins. |
| + void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, value); } // -- start List<num> mixins. |
| // num is the element type. |
| // From Iterable<num>: |
| @@ -9073,8 +9097,7 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior |
| num operator[](int index) => JS("num", "#[#]", this, index); |
| - void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<num> mixins. |
| + void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, value); } // -- start List<num> mixins. |
| // num is the element type. |
| // From Iterable<num>: |
| @@ -11194,8 +11217,7 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |
| @@ -11305,8 +11327,7 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |
| @@ -11416,8 +11437,7 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |
| @@ -17996,8 +18016,7 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior, |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |
| @@ -18107,8 +18126,7 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior, |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |
| @@ -18218,8 +18236,7 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, |
| int operator[](int index) => JS("int", "#[#]", this, index); |
| - void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } |
| - // -- start List<int> mixins. |
| + void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, value); } // -- start List<int> mixins. |
| // int is the element type. |
| // From Iterable<int>: |