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 a95a00e84402ca51651da4bbfd413eb84938e9fa..ca9576d2421f975fc3e5d2ce30d8756c12ee507d 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -9336,16 +9336,44 @@ class _ElementCssClassSet extends CssClassSet { |
} |
} |
+/** |
+ * The base class of all components for an HTML document. |
+ */ |
abstract class Element extends Node implements ElementTraversal { |
+ /** |
+ * Creates an HTML Element from a valid fragment of HTML. |
+ * The [html] fragment must represent valid HTML with a single element root, |
+ * which will be parsed and returned. |
+ * |
+ * Important: the contents of [html] should not contain any user-supplied |
+ * data. Without strict data validation it is impossible to prevent script |
+ * injection exploits. |
+ * |
+ * It is instead recommended that elements be constructed via [Element.tag] |
+ * and text be added via [text]. |
+ */ |
factory Element.html(String html) => |
_ElementFactoryProvider.createElement_html(html); |
+ |
+ /** |
+ * Creates the HTML element specified by the tag name. |
+ * This is similar to document.createElement. |
+ * [tag] should be a valid HTML tag name. If [tag] is an unknown tag then |
+ * this will create an [UnknownElement]. |
+ * var element = new Element.tag('div'); |
+ * For standard elements it is more preferable to use the type constructors: |
+ * var element = new DivElement(); |
+ */ |
factory Element.tag(String tag) => |
_ElementFactoryProvider.createElement_tag(tag); |
/** |
- * @domName Element.hasAttribute, Element.getAttribute, Element.setAttribute, |
- * Element.removeAttribute |
+ * Provides access to all attributes on this element. |
+ * This only includes attributes in the default namespace, additional |
+ * attributes can be accessed via [getNamespacedAttributes]. |
+ * Any modifications to the map will automatically be applied to this |
+ * element. |
*/ |
Map<String, String> get attributes => new _ElementAttributeMap(this); |
@@ -9375,8 +9403,8 @@ abstract class Element extends Node implements ElementTraversal { |
List<Element> get elements => this.children; |
/** |
- * @domName childElementCount, firstElementChild, lastElementChild, |
- * children, Node.nodes.add |
+ * List of the direct children of this element. |
+ * This collection can be used to add and remove elements from the document. |
*/ |
List<Element> get children => new _ChildrenElementList._wrap(this); |
@@ -9388,12 +9416,32 @@ abstract class Element extends Node implements ElementTraversal { |
children.addAll(copy); |
} |
+ /** |
+ * Finds the first descendent element of this element that matches the |
+ * specified group of selectors. |
+ * [selectors] should be a string using CSS selector syntax. |
+ * var element = element.query('.className'); |
+ * var element = element.query('#id'); |
+ */ |
Element query(String selectors) => $dom_querySelector(selectors); |
+ /** |
+ * Finds all descendent elements of this element that match the specified |
+ * group of selectors. |
+ * [selectors] should be a string using CSS selector syntax. |
+ * var items = element.query('.itemClassName'); |
+ */ |
List<Element> queryAll(String selectors) => |
new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); |
- /** @domName className, classList */ |
+ /** |
+ * The set of CSS classes applied to this element. |
+ * This set makes it easy to add, remove or toggle the classes applied to |
+ * this element. |
+ * element.classes.add('selected'); |
+ * element.classes.toggle('isOnline'); |
+ * element.classes.remove('selected'); |
+ */ |
CssClassSet get classes => new _ElementCssClassSet(this); |
void set classes(Collection<String> value) { |
@@ -9402,6 +9450,17 @@ abstract class Element extends Node implements ElementTraversal { |
classSet.addAll(value); |
} |
+ /** |
+ * Allows access to all custom data attributes (data-*) set on this element. |
+ * The keys for the map must follow these rules: |
+ * * The name must not begin with `xml`. |
+ * * The name cannot contain a semi-colon (`;`). |
+ * * The name cannot contain any capitol letters. |
+ * |
+ * Any keys from markup will be converted to camel-cased keys in the map |
+ * This means that a key of 'camel-cased-name' would be converted to |
+ * 'camelCasedName'. |
+ */ |
Map<String, String> get dataAttributes => |
new _DataAttributeMap(attributes); |
@@ -9421,13 +9480,23 @@ abstract class Element extends Node implements ElementTraversal { |
return new _NamespacedAttributeMap(this, namespace); |
} |
- /** @domName Window.getComputedStyle */ |
+ /** |
+ * Gets the final set of all CSS values applied to this element, including |
+ * inherited and default values. |
+ * As opposed to the [style] property which contains the values specified |
+ * directly on this element, computedStyle contains the values which are |
+ * inherited from other sources, such as parent elements or stylesheets. |
+ */ |
Future<CSSStyleDeclaration> get computedStyle { |
// TODO(jacobr): last param should be null, see b/5045788 |
return getComputedStyle(''); |
} |
- /** @domName Window.getComputedStyle */ |
+ /** |
+ * Gets the computed style of a pseudoElement of this element. |
+ * Similar to [computedStyle] but this targets pseudo-elements such as |
+ * `::after, ::before, ::marker, ::line-marker`. |
+ */ |
Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { |
return _createMeasurementFuture( |
() => window.$dom_getComputedStyle(this, pseudoElement), |