Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 11413071: Deprecating Element.elements for Element.children. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 954772603949c5f88ed55564d07c805951da94c2..4a69f4cb985ac7a38f187e85bb337d45d5b40d0e 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -8795,6 +8795,20 @@ class DocumentFragment extends Node {
elements.addAll(copy);
}
+ List<Element> _children;
+ List<Element> get children {
+ if (_children == null) {
+ _children = new FilteredElementList(this);
+ }
+ return _children;
+ }
+
+ void set children(Collection<Element> value) {
+ final children = this.children;
+ children.clear();
+ children.addAll(value);
+ }
+
Element query(String selectors) => $dom_querySelector(selectors);
List<Element> queryAll(String selectors) =>
@@ -9647,10 +9661,21 @@ abstract class Element extends Node implements ElementTraversal {
}
/**
+ * Deprecated, use [children] instead.
+ */
+ List<Element> get elements => new _ChildrenElementList._wrap(this);
+
+ /**
* @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);
@@ -10035,15 +10060,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();
@@ -21740,7 +21765,7 @@ class Storage extends NativeFieldWrapperClass1 implements Map<String, String> {
String operator [](String key) => $dom_getItem(key);
- void operator []=(String key, String value) => $dom_setItem(key, value);
+ void operator []=(String key, String value) { $dom_setItem(key, value); }
String putIfAbsent(String key, String ifAbsent()) {
if (!containsKey(key)) this[key] = ifAbsent();

Powered by Google App Engine
This is Rietveld 408576698