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..5b129029d2428c139780deb1d172af3860bbef7f 100644 |
| --- a/sdk/lib/html/dart2js/html_dart2js.dart |
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart |
| @@ -6785,22 +6785,29 @@ class DocumentFragment extends Node native "*DocumentFragment" { |
| factory DocumentFragment.svg(String svgContent) => |
| _DocumentFragmentFactoryProvider.createDocumentFragment_svg(svgContent); |
| - List<Element> _elements; |
| + List<Element> get elements => this.children; |
| - List<Element> get elements { |
| - if (_elements == null) { |
| - _elements = new FilteredElementList(this); |
| + // TODO: The type of value should be Collection<Element>. See http://b/5392897 |
| + void set elements(value) { |
| + this.children = value; |
| + } |
| + |
| + List<Element> _children; |
| + |
| + @Creates('Null') |
|
sra1
2012/11/19 22:16:34
This goes on the field '_children'.
Please include
blois
2012/11/19 22:58:53
Done.
|
| + List<Element> get children { |
| + if (_children == null) { |
| + _children = new FilteredElementList(this); |
| } |
| - return _elements; |
| + return _children; |
| } |
| - // TODO: The type of value should be Collection<Element>. See http://b/5392897 |
| - void set elements(value) { |
| + void set children(Collection<Element> value) { |
| // Copy list first since we don't want liveness during iteration. |
| List copy = new List.from(value); |
| - final elements = this.elements; |
| - elements.clear(); |
| - elements.addAll(copy); |
| + var children = this.children; |
| + children.clear(); |
| + children.addAll(copy); |
| } |
| Element query(String selectors) => $dom_querySelector(selectors); |
| @@ -7621,16 +7628,28 @@ abstract class Element extends Node implements ElementTraversal native "*Element |
| } |
| void set elements(Collection<Element> value) { |
| - final elements = this.elements; |
| - elements.clear(); |
| - elements.addAll(value); |
| + this.children = value; |
| } |
| /** |
| + * Deprecated, use [children] instead. |
| + */ |
| + List<Element> get elements => this.children; |
| + |
| + /** |
| * @domName childElementCount, firstElementChild, lastElementChild, |
| * children, Node.nodes.add |
| */ |
| - List<Element> get elements => new _ChildrenElementList._wrap(this); |
| + @Creates('Null') |
|
sra1
2012/11/19 22:16:34
Remove.
Not needed on Dart code, only fields and m
blois
2012/11/19 22:58:53
Done.
|
| + List<Element> get children => new _ChildrenElementList._wrap(this); |
| + |
| + void set children(Collection<Element> value) { |
| + // Copy list first since we don't want liveness during iteration. |
| + List copy = new List.from(value); |
| + var children = this.children; |
| + children.clear(); |
| + children.addAll(copy); |
| + } |
| Element query(String selectors) => $dom_querySelector(selectors); |
| @@ -7984,15 +8003,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 +8981,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. |
|
sra1
2012/11/19 22:16:34
What happened here?
blois
2012/11/19 22:58:53
Looks like the file was out of date. Sync'd and it
|
| // num is the element type. |
| // From Iterable<num>: |
| @@ -9073,8 +9091,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 +11211,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 +11321,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 +11431,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 +18010,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 +18120,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 +18230,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>: |