Dart API Referencedart:htmlElement

Element abstract class

An abstract class, which all HTML elements extend.

@DomName('Element')
abstract class Element extends Node implements ElementTraversal native "Element" {

 /**
  * 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].
  *
  *     var element = new Element.html('<div class="foo">content</div>');
  */
 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 divElement = new Element.tag('div');
  *     print(divElement is DivElement); // 'true'
  *     var myElement = new Element.tag('unknownTag');
  *     print(myElement is UnknownElement); // 'true'
  *
  * For standard elements it is more preferable to use the type constructors:
  *     var element = new DivElement();
  *
  * See also:
  *
  * * [isTagSupported]
  */
 factory Element.tag(String tag) =>
     _ElementFactoryProvider.createElement_tag(tag);

 /**
  * All attributes on this element.
  *
  * Any modifications to the attribute map will automatically be applied to
  * this element.
  *
  * This only includes attributes which are not in a namespace
  * (such as 'xlink:href'), additional attributes can be accessed via
  * [getNamespacedAttributes].
  */
 Map<String, String> get attributes => new _ElementAttributeMap(this);

 void set attributes(Map<String, String> value) {
   Map<String, String> attributes = this.attributes;
   attributes.clear();
   for (String key in value.keys) {
     attributes[key] = value[key];
   }
 }

 /**
  * List of the direct children of this element.
  *
  * This collection can be used to add and remove elements from the document.
  *
  *     var item = new DivElement();
  *     item.text = 'Something';
  *     document.body.children.add(item) // Item is now displayed on the page.
  *     for (var element in document.body.children) {
  *       element.style.background = 'red'; // Turns every child of body red.
  *     }
  */
 List<Element> get children => new _ChildrenElementList._wrap(this);

 void set children(List<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);
 }

 /**
  * 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');
  */
 ElementList queryAll(String selectors) =>
   new _FrozenElementList._wrap($dom_querySelectorAll(selectors));

 /**
  * 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(Iterable<String> value) {
   CssClassSet classSet = classes;
   classSet.clear();
   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 capital letters.
  *
  * Any keys from markup will be converted to camel-cased keys in the map.
  *
  * For example, HTML specified as:
  *
  *     <div data-my-random-value='value'></div>
  *
  * Would be accessed in Dart as:
  *
  *     var value = element.dataset['myRandomValue'];
  *
  * See also:
  *
  * * [Custom data attributes](http://www.w3.org/TR/html5/global-attributes.html#custom-data-attribute)
  */
 Map<String, String> get dataset =>
   new _DataAttributeMap(attributes);

 void set dataset(Map<String, String> value) {
   final data = this.dataset;
   data.clear();
   for (String key in value.keys) {
     data[key] = value[key];
   }
 }

 /**
  * Gets a map for manipulating the attributes of a particular namespace.
  *
  * This is primarily useful for SVG attributes such as xref:link.
  */
 Map<String, String> getNamespacedAttributes(String namespace) {
   return new _NamespacedAttributeMap(this, namespace);
 }

 /**
  * The set of all CSS values applied to this element, including inherited
  * and default values.
  *
  * The computedStyle contains values that are inherited from other
  * sources, such as parent elements or stylesheets. This differs from the
  * [style] property, which contains only the values specified directly on this
  * element.
  *
  * PseudoElement can be values such as `::after`, `::before`, `::marker`,
  * `::line-marker`.
  *
  * See also:
  *
  * * [CSS Inheritance and Cascade](http://docs.webplatform.org/wiki/tutorials/inheritance_and_cascade)
  * * [Pseudo-elements](http://docs.webplatform.org/wiki/css/selectors/pseudo-elements)
  */
 CssStyleDeclaration getComputedStyle([String pseudoElement]) {
   if (pseudoElement == null) {
     pseudoElement = '';
   }
   // TODO(jacobr): last param should be null, see b/5045788
   return window.$dom_getComputedStyle(this, pseudoElement);
 }

 /**
  * Gets the position of this element relative to the client area of the page.
  */
 Rect get client => new Rect(clientLeft, clientTop, clientWidth, clientHeight);

 /**
  * Gets the offset of this element relative to its offsetParent.
  */
 Rect get offset => new Rect(offsetLeft, offsetTop, offsetWidth, offsetHeight);

 /**
  * Adds the specified text as a text node after the last child of this
  * element.
  */
 void appendText(String text) {
   this.insertAdjacentText('beforeend', text);
 }

 /**
  * Parses the specified text as HTML and adds the resulting node after the
  * last child of this element.
  */
 void appendHtml(String text) {
   this.insertAdjacentHtml('beforeend', text);
 }

 /**
  * Checks to see if the tag name is supported by the current platform.
  *
  * The tag should be a valid HTML tag name.
  */
 static bool isTagSupported(String tag) {
   var e = _ElementFactoryProvider.createElement_tag(tag);
   return e is Element && !(e is UnknownElement);
 }

 /**
  * Called by the DOM when this element has been instantiated.
  */
 @Experimental
 void onCreated() {}

 // Hooks to support custom WebComponents.

 @Creates('Null')  // Set from Dart code; does not instantiate a native type.
 Element _xtag;

 /**
  * Experimental support for [web components][wc]. This field stores a
  * reference to the component implementation. It was inspired by Mozilla's
  * [x-tags][] project. Please note: in the future it may be possible to
  * `extend Element` from your class, in which case this field will be
  * deprecated.
  *
  * If xtag has not been set, it will simply return `this` [Element].
  *
  * [wc]: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html
  * [x-tags]: http://x-tags.org/
  */
 // Note: return type is `dynamic` for convenience to suppress warnings when
 // members of the component are used. The actual type is a subtype of Element.
 get xtag => _xtag != null ? _xtag : this;

 void set xtag(Element value) {
   _xtag = value;
 }

 @DomName('Element.localName')
 @DocsEditable
 String get localName => $dom_localName;

 @DomName('Element.namespaceUri')
 @DocsEditable
 String get namespaceUri => $dom_namespaceUri;

 String toString() => localName;

 /**
  * Scrolls this element into view.
  *
  * Only one of of the alignment options may be specified at a time.
  *
  * If no options are specified then this will attempt to scroll the minimum
  * amount needed to bring the element into view.
  *
  * Note that alignCenter is currently only supported on WebKit platforms. If
  * alignCenter is specified but not supported then this will fall back to
  * alignTop.
  *
  * See also:
  *
  * * [scrollIntoView](http://docs.webplatform.org/wiki/dom/methods/scrollIntoView)
  * * [scrollIntoViewIfNeeded](http://docs.webplatform.org/wiki/dom/methods/scrollIntoViewIfNeeded)
  */
 void scrollIntoView([ScrollAlignment alignment]) {
   var hasScrollIntoViewIfNeeded = false;
   hasScrollIntoViewIfNeeded =
       JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
   if (alignment == ScrollAlignment.TOP) {
     this.$dom_scrollIntoView(true);
   } else if (alignment == ScrollAlignment.BOTTOM) {
     this.$dom_scrollIntoView(false);
   } else if (hasScrollIntoViewIfNeeded) {
     if (alignment == ScrollAlignment.CENTER) {
       this.$dom_scrollIntoViewIfNeeded(true);
     } else {
       this.$dom_scrollIntoViewIfNeeded();
     }
   } else {
     this.$dom_scrollIntoView();
   }
 }

 @DomName('Element.mouseWheelEvent')
 static const EventStreamProvider<WheelEvent> mouseWheelEvent =
     const _CustomEventStreamProvider<WheelEvent>(
       Element._determineMouseWheelEventType);

 static String _determineMouseWheelEventType(EventTarget e) {
   if (JS('bool', '#.onwheel !== undefined', e)) {
     // W3C spec, and should be IE9+, but IE has a bug exposing onwheel.
     return 'wheel';
   } else if (JS('bool', '#.onmousewheel !== undefined', e)) {
     // Chrome & IE
     return 'mousewheel';
   } else {
     // Firefox
     return 'DOMMouseScroll';
   }
 }

 @DomName('Element.transitionEndEvent')
 static const EventStreamProvider<TransitionEvent> transitionEndEvent =
     const _CustomEventStreamProvider<TransitionEvent>(
       Element._determineTransitionEventType);

 static String _determineTransitionEventType(EventTarget e) {
   // Unfortunately the normal 'ontransitionend' style checks don't work here.
   if (Device.isWebKit) {
     return 'webkitTransitionEnd';
   } else if (Device.isOpera) {
     return 'oTransitionEnd';
   }
   return 'transitionend';
 }
 /**
  * Creates a text node and inserts it into the DOM at the specified location.
  *
  * To see the possible values for [where], read the doc for
  * [insertAdjacentHtml].
  *
  * See also:
  *
  * * [insertAdjacentHtml]
  */
 void insertAdjacentText(String where, String text) {
   if (JS('bool', '!!#.insertAdjacentText', this)) {
     _insertAdjacentText(where, text);
   } else {
     _insertAdjacentNode(where, new Text(text));
   }
 }

 @JSName('insertAdjacentText')
 void _insertAdjacentText(String where, String text) native;

 /**
  * Parses text as an HTML fragment and inserts it into the DOM at the
  * specified location.
  *
  * The [where] parameter indicates where to insert the HTML fragment:
  *
  * * 'beforeBegin': Immediately before this element.
  * * 'afterBegin': As the first child of this element.
  * * 'beforeEnd': As the last child of this element.
  * * 'afterEnd': Immediately after this element.
  *
  *     var html = '<div class="something">content</div>';
  *     // Inserts as the first child
  *     document.body.insertAdjacentHtml('afterBegin', html);
  *     var createdElement = document.body.children[0];
  *     print(createdElement.classes[0]); // Prints 'something'
  *
  * See also:
  *
  * * [insertAdjacentText]
  * * [insertAdjacentElement]
  */
 void insertAdjacentHtml(String where, String html) {
   if (JS('bool', '!!#.insertAdjacentHTML', this)) {
     _insertAdjacentHtml(where, html);
   } else {
     _insertAdjacentNode(where, new DocumentFragment.html(html));
   }
 }

 @JSName('insertAdjacentHTML')
 void _insertAdjacentHtml(String where, String text) native;

 /**
  * Inserts [element] into the DOM at the specified location.
  *
  * To see the possible values for [where], read the doc for
  * [insertAdjacentHtml].
  *
  * See also:
  *
  * * [insertAdjacentHtml]
  */
 Element insertAdjacentElement(String where, Element element) {
   if (JS('bool', '!!#.insertAdjacentElement', this)) {
     _insertAdjacentElement(where, element);
   } else {
     _insertAdjacentNode(where, element);
   }
   return element;
 }

 @JSName('insertAdjacentElement')
 void _insertAdjacentElement(String where, Element element) native;

 void _insertAdjacentNode(String where, Node node) {
   switch (where.toLowerCase()) {
     case 'beforebegin':
       this.parentNode.insertBefore(node, this);
       break;
     case 'afterbegin':
       var first = this.nodes.length > 0 ? this.nodes[0] : null;
       this.insertBefore(node, first);
       break;
     case 'beforeend':
       this.append(node);
       break;
     case 'afterend':
       this.parentNode.insertBefore(node, this.nextNode);
       break;
     default:
       throw new ArgumentError("Invalid position ${where}");
   }
 }

 /**
  * Checks if this element matches the CSS selectors.
  */
 @Experimental
 bool matches(String selectors) {
   if (JS('bool', '!!#.matches', this)) {
     return JS('bool', '#.matches(#)', this, selectors);
   } else if (JS('bool', '!!#.webkitMatchesSelector', this)) {
     return JS('bool', '#.webkitMatchesSelector(#)', this, selectors);
   } else if (JS('bool', '!!#.mozMatchesSelector', this)) {
     return JS('bool', '#.mozMatchesSelector(#)', this, selectors);
   } else if (JS('bool', '!!#.msMatchesSelector', this)) {
     return JS('bool', '#.msMatchesSelector(#)', this, selectors);
   }
   throw new UnsupportedError("Not supported on this platform");
 }

 @Creates('Null') // Set from Dart code; does not instantiate a native type.
 Map<String, StreamSubscription> _attributeBindings;

 // TODO(jmesserly): I'm concerned about adding these to every element.
 // Conceptually all of these belong on TemplateElement. They are here to
 // support browsers that don't have <template> yet.
 // However even in the polyfill they're restricted to certain tags
 // (see [isTemplate]). So we can probably convert it to a (public) mixin, and
 // only mix it in to the elements that need it.
 @Creates('Null')  // Set from Dart code; does not instantiate a native type.
 var _model;

 @Creates('Null')  // Set from Dart code; does not instantiate a native type.
 _TemplateIterator _templateIterator;

 @Creates('Null')  // Set from Dart code; does not instantiate a native type.
 Element _templateInstanceRef;

 // Note: only used if `this is! TemplateElement`
 @Creates('Null')  // Set from Dart code; does not instantiate a native type.
 DocumentFragment _templateContent;

 bool _templateIsDecorated;

 // TODO(jmesserly): should path be optional, and default to empty path?
 // It is used that way in at least one path in JS TemplateElement tests
 // (see "BindImperative" test in original JS code).
 @Experimental
 void bind(String name, model, String path) {
   _bindElement(this, name, model, path);
 }

 // TODO(jmesserly): this is static to work around http://dartbug.com/10166
 // Similar issue for unbind/unbindAll below.
 static void _bindElement(Element self, String name, model, String path) {
   if (self._bindTemplate(name, model, path)) return;

   if (self._attributeBindings == null) {
     self._attributeBindings = new Map<String, StreamSubscription>();
   }

   self.xtag.attributes.remove(name);

   var changed;
   if (name.endsWith('?')) {
     name = name.substring(0, name.length - 1);

     changed = (value) {
       if (_Bindings._toBoolean(value)) {
         self.xtag.attributes[name] = '';
       } else {
         self.xtag.attributes.remove(name);
       }
     };
   } else {
     changed = (value) {
       // TODO(jmesserly): escape value if needed to protect against XSS.
       // See https://github.com/polymer-project/mdv/issues/58
       self.xtag.attributes[name] = value == null ? '' : '$value';
     };
   }

   self.unbind(name);

   self._attributeBindings[name] =
       new PathObserver(model, path).bindSync(changed);
 }

 @Experimental
 void unbind(String name) {
   _unbindElement(this, name);
 }

 static _unbindElement(Element self, String name) {
   if (self._unbindTemplate(name)) return;
   if (self._attributeBindings != null) {
     var binding = self._attributeBindings.remove(name);
     if (binding != null) binding.cancel();
   }
 }

 @Experimental
 void unbindAll() {
   _unbindAllElement(this);
 }

 static void _unbindAllElement(Element self) {
   self._unbindAllTemplate();

   if (self._attributeBindings != null) {
     for (var binding in self._attributeBindings.values) {
       binding.cancel();
     }
     self._attributeBindings = null;
   }
 }

 // TODO(jmesserly): unlike the JS polyfill, we can't mixin
 // HTMLTemplateElement at runtime into things that are semantically template
 // elements. So instead we implement it here with a runtime check.
 // If the bind succeeds, we return true, otherwise we return false and let
 // the normal Element.bind logic kick in.
 bool _bindTemplate(String name, model, String path) {
   if (isTemplate) {
     switch (name) {
       case 'bind':
       case 'repeat':
       case 'if':
         _ensureTemplate();
         if (_templateIterator == null) {
           _templateIterator = new _TemplateIterator(this);
         }
         _templateIterator.inputs.bind(name, model, path);
         return true;
     }
   }
   return false;
 }

 bool _unbindTemplate(String name) {
   if (isTemplate) {
     switch (name) {
       case 'bind':
       case 'repeat':
       case 'if':
         _ensureTemplate();
         if (_templateIterator != null) {
           _templateIterator.inputs.unbind(name);
         }
         return true;
     }
   }
   return false;
 }

 void _unbindAllTemplate() {
   if (isTemplate) {
     unbind('bind');
     unbind('repeat');
     unbind('if');
   }
 }

 /**
  * Gets the template this node refers to.
  * This is only supported if [isTemplate] is true.
  */
 @Experimental
 Element get ref {
   _ensureTemplate();

   Element ref = null;
   var refId = attributes['ref'];
   if (refId != null) {
     ref = document.getElementById(refId);
   }

   return ref != null ? ref : _templateInstanceRef;
 }

 /**
  * Gets the content of this template.
  * This is only supported if [isTemplate] is true.
  */
 @Experimental
 DocumentFragment get content {
   _ensureTemplate();
   return _templateContent;
 }

 /**
  * Creates an instance of the template.
  * This is only supported if [isTemplate] is true.
  */
 @Experimental
 DocumentFragment createInstance() {
   _ensureTemplate();

   var template = ref;
   if (template == null) template = this;

   var instance = _Bindings._createDeepCloneAndDecorateTemplates(
       template.content, attributes['syntax']);

   if (TemplateElement._instanceCreated != null) {
     TemplateElement._instanceCreated.add(instance);
   }
   return instance;
 }

 /**
  * The data model which is inherited through the tree.
  * This is only supported if [isTemplate] is true.
  *
  * Setting this will destructive propagate the value to all descendant nodes,
  * and reinstantiate all of the nodes expanded by this template.
  *
  * Currently this does not support propagation through Shadow DOMs.
  */
 @Experimental
 get model => _model;

 @Experimental
 void set model(value) {
   _ensureTemplate();

   var syntax = TemplateElement.syntax[attributes['syntax']];
   _model = value;
   _Bindings._addBindings(this, model, syntax);
 }

 // TODO(jmesserly): const set would be better
 static const _TABLE_TAGS = const {
   'caption': null,
   'col': null,
   'colgroup': null,
   'tbody': null,
   'td': null,
   'tfoot': null,
   'th': null,
   'thead': null,
   'tr': null,
 };

 bool get _isAttributeTemplate => attributes.containsKey('template') &&
     (localName == 'option' || _TABLE_TAGS.containsKey(localName));

 /**
  * Returns true if this node is a template.
  *
  * A node is a template if [tagName] is TEMPLATE, or the node has the
  * 'template' attribute and this tag supports attribute form for backwards
  * compatibility with existing HTML parsers. The nodes that can use attribute
  * form are table elments (THEAD, TBODY, TFOOT, TH, TR, TD, CAPTION, COLGROUP
  * and COL) and OPTION.
  */
 // TODO(jmesserly): this is not a public MDV API, but it seems like a useful
 // place to document which tags our polyfill considers to be templates.
 // Otherwise I'd be repeating it in several other places.
 // See if we can replace this with a TemplateMixin.
 @Experimental
 bool get isTemplate => tagName == 'TEMPLATE' || _isAttributeTemplate;

 void _ensureTemplate() {
   if (!isTemplate) {
     throw new UnsupportedError('$this is not a template.');
   }
   TemplateElement.decorate(this);
 }


 @DomName('Element.abortEvent')
 @DocsEditable
 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort');

 @DomName('Element.beforecopyEvent')
 @DocsEditable
 static const EventStreamProvider<Event> beforeCopyEvent = const EventStreamProvider<Event>('beforecopy');

 @DomName('Element.beforecutEvent')
 @DocsEditable
 static const EventStreamProvider<Event> beforeCutEvent = const EventStreamProvider<Event>('beforecut');

 @DomName('Element.beforepasteEvent')
 @DocsEditable
 static const EventStreamProvider<Event> beforePasteEvent = const EventStreamProvider<Event>('beforepaste');

 @DomName('Element.blurEvent')
 @DocsEditable
 static const EventStreamProvider<Event> blurEvent = const EventStreamProvider<Event>('blur');

 @DomName('Element.changeEvent')
 @DocsEditable
 static const EventStreamProvider<Event> changeEvent = const EventStreamProvider<Event>('change');

 @DomName('Element.clickEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> clickEvent = const EventStreamProvider<MouseEvent>('click');

 @DomName('Element.contextmenuEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> contextMenuEvent = const EventStreamProvider<MouseEvent>('contextmenu');

 @DomName('Element.copyEvent')
 @DocsEditable
 static const EventStreamProvider<Event> copyEvent = const EventStreamProvider<Event>('copy');

 @DomName('Element.cutEvent')
 @DocsEditable
 static const EventStreamProvider<Event> cutEvent = const EventStreamProvider<Event>('cut');

 @DomName('Element.dblclickEvent')
 @DocsEditable
 static const EventStreamProvider<Event> doubleClickEvent = const EventStreamProvider<Event>('dblclick');

 @DomName('Element.dragEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragEvent = const EventStreamProvider<MouseEvent>('drag');

 @DomName('Element.dragendEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragEndEvent = const EventStreamProvider<MouseEvent>('dragend');

 @DomName('Element.dragenterEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragEnterEvent = const EventStreamProvider<MouseEvent>('dragenter');

 @DomName('Element.dragleaveEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragLeaveEvent = const EventStreamProvider<MouseEvent>('dragleave');

 @DomName('Element.dragoverEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragOverEvent = const EventStreamProvider<MouseEvent>('dragover');

 @DomName('Element.dragstartEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dragStartEvent = const EventStreamProvider<MouseEvent>('dragstart');

 @DomName('Element.dropEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> dropEvent = const EventStreamProvider<MouseEvent>('drop');

 @DomName('Element.errorEvent')
 @DocsEditable
 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');

 @DomName('Element.focusEvent')
 @DocsEditable
 static const EventStreamProvider<Event> focusEvent = const EventStreamProvider<Event>('focus');

 @DomName('Element.inputEvent')
 @DocsEditable
 static const EventStreamProvider<Event> inputEvent = const EventStreamProvider<Event>('input');

 @DomName('Element.invalidEvent')
 @DocsEditable
 static const EventStreamProvider<Event> invalidEvent = const EventStreamProvider<Event>('invalid');

 @DomName('Element.keydownEvent')
 @DocsEditable
 static const EventStreamProvider<KeyboardEvent> keyDownEvent = const EventStreamProvider<KeyboardEvent>('keydown');

 @DomName('Element.keypressEvent')
 @DocsEditable
 static const EventStreamProvider<KeyboardEvent> keyPressEvent = const EventStreamProvider<KeyboardEvent>('keypress');

 @DomName('Element.keyupEvent')
 @DocsEditable
 static const EventStreamProvider<KeyboardEvent> keyUpEvent = const EventStreamProvider<KeyboardEvent>('keyup');

 @DomName('Element.loadEvent')
 @DocsEditable
 static const EventStreamProvider<Event> loadEvent = const EventStreamProvider<Event>('load');

 @DomName('Element.mousedownEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown');

 @DomName('Element.mousemoveEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove');

 @DomName('Element.mouseoutEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> mouseOutEvent = const EventStreamProvider<MouseEvent>('mouseout');

 @DomName('Element.mouseoverEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> mouseOverEvent = const EventStreamProvider<MouseEvent>('mouseover');

 @DomName('Element.mouseupEvent')
 @DocsEditable
 static const EventStreamProvider<MouseEvent> mouseUpEvent = const EventStreamProvider<MouseEvent>('mouseup');

 @DomName('Element.pasteEvent')
 @DocsEditable
 static const EventStreamProvider<Event> pasteEvent = const EventStreamProvider<Event>('paste');

 @DomName('Element.resetEvent')
 @DocsEditable
 static const EventStreamProvider<Event> resetEvent = const EventStreamProvider<Event>('reset');

 @DomName('Element.scrollEvent')
 @DocsEditable
 static const EventStreamProvider<Event> scrollEvent = const EventStreamProvider<Event>('scroll');

 @DomName('Element.searchEvent')
 @DocsEditable
 // http://www.w3.org/TR/html-markup/input.search.html
 @Experimental
 static const EventStreamProvider<Event> searchEvent = const EventStreamProvider<Event>('search');

 @DomName('Element.selectEvent')
 @DocsEditable
 static const EventStreamProvider<Event> selectEvent = const EventStreamProvider<Event>('select');

 @DomName('Element.selectstartEvent')
 @DocsEditable
 @Experimental // nonstandard
 static const EventStreamProvider<Event> selectStartEvent = const EventStreamProvider<Event>('selectstart');

 @DomName('Element.submitEvent')
 @DocsEditable
 static const EventStreamProvider<Event> submitEvent = const EventStreamProvider<Event>('submit');

 @DomName('Element.touchcancelEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchCancelEvent = const EventStreamProvider<TouchEvent>('touchcancel');

 @DomName('Element.touchendEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchEndEvent = const EventStreamProvider<TouchEvent>('touchend');

 @DomName('Element.touchenterEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchEnterEvent = const EventStreamProvider<TouchEvent>('touchenter');

 @DomName('Element.touchleaveEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchLeaveEvent = const EventStreamProvider<TouchEvent>('touchleave');

 @DomName('Element.touchmoveEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchMoveEvent = const EventStreamProvider<TouchEvent>('touchmove');

 @DomName('Element.touchstartEvent')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 static const EventStreamProvider<TouchEvent> touchStartEvent = const EventStreamProvider<TouchEvent>('touchstart');

 @DomName('Element.webkitfullscreenchangeEvent')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
 static const EventStreamProvider<Event> fullscreenChangeEvent = const EventStreamProvider<Event>('webkitfullscreenchange');

 @DomName('Element.webkitfullscreenerrorEvent')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
 static const EventStreamProvider<Event> fullscreenErrorEvent = const EventStreamProvider<Event>('webkitfullscreenerror');

 @DomName('Element.contentEditable')
 @DocsEditable
 String contentEditable;

 @DomName('Element.dir')
 @DocsEditable
 String dir;

 @DomName('Element.draggable')
 @DocsEditable
 bool draggable;

 @DomName('Element.hidden')
 @DocsEditable
 bool hidden;

 @DomName('Element.id')
 @DocsEditable
 String id;

 @JSName('innerHTML')
 @DomName('Element.innerHTML')
 @DocsEditable
 String innerHtml;

 @DomName('Element.isContentEditable')
 @DocsEditable
 final bool isContentEditable;

 @DomName('Element.lang')
 @DocsEditable
 String lang;

 @JSName('outerHTML')
 @DomName('Element.outerHTML')
 @DocsEditable
 final String outerHtml;

 @DomName('Element.spellcheck')
 @DocsEditable
 // http://blog.whatwg.org/the-road-to-html-5-spellchecking
 @Experimental // nonstandard
 bool spellcheck;

 @DomName('Element.tabIndex')
 @DocsEditable
 int tabIndex;

 @DomName('Element.title')
 @DocsEditable
 String title;

 @DomName('Element.translate')
 @DocsEditable
 // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-translate-attribute
 @Experimental
 bool translate;

 @JSName('webkitdropzone')
 @DomName('Element.webkitdropzone')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#the-dropzone-attribute
 String dropzone;

 @DomName('Element.click')
 @DocsEditable
 void click() native;

 @DomName('Element.getInputContext')
 @DocsEditable
 // http://www.w3.org/TR/ime-api/#the-getinputcontext-method
 @Experimental
 InputMethodContext getInputContext() native;

 @DomName('Element.ALLOW_KEYBOARD_INPUT')
 @DocsEditable
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-element-requestfullscreen
 @deprecated // deprecated
 static const int ALLOW_KEYBOARD_INPUT = 1;

 @JSName('attributes')
 @DomName('Element.attributes')
 @DocsEditable
 final _NamedNodeMap $dom_attributes;

 @JSName('childElementCount')
 @DomName('Element.childElementCount')
 @DocsEditable
 final int $dom_childElementCount;

 @JSName('children')
 @DomName('Element.children')
 @DocsEditable
 final HtmlCollection $dom_children;

 @JSName('className')
 @DomName('Element.className')
 @DocsEditable
 String $dom_className;

 @DomName('Element.clientHeight')
 @DocsEditable
 final int clientHeight;

 @DomName('Element.clientLeft')
 @DocsEditable
 final int clientLeft;

 @DomName('Element.clientTop')
 @DocsEditable
 final int clientTop;

 @DomName('Element.clientWidth')
 @DocsEditable
 final int clientWidth;

 @JSName('firstElementChild')
 @DomName('Element.firstElementChild')
 @DocsEditable
 final Element $dom_firstElementChild;

 @JSName('lastElementChild')
 @DomName('Element.lastElementChild')
 @DocsEditable
 final Element $dom_lastElementChild;

 @DomName('Element.nextElementSibling')
 @DocsEditable
 final Element nextElementSibling;

 @DomName('Element.offsetHeight')
 @DocsEditable
 final int offsetHeight;

 @DomName('Element.offsetLeft')
 @DocsEditable
 final int offsetLeft;

 @DomName('Element.offsetParent')
 @DocsEditable
 final Element offsetParent;

 @DomName('Element.offsetTop')
 @DocsEditable
 final int offsetTop;

 @DomName('Element.offsetWidth')
 @DocsEditable
 final int offsetWidth;

 @DomName('Element.previousElementSibling')
 @DocsEditable
 final Element previousElementSibling;

 @DomName('Element.scrollHeight')
 @DocsEditable
 final int scrollHeight;

 @DomName('Element.scrollLeft')
 @DocsEditable
 int scrollLeft;

 @DomName('Element.scrollTop')
 @DocsEditable
 int scrollTop;

 @DomName('Element.scrollWidth')
 @DocsEditable
 final int scrollWidth;

 @DomName('Element.style')
 @DocsEditable
 final CssStyleDeclaration style;

 @DomName('Element.tagName')
 @DocsEditable
 final String tagName;

 @JSName('webkitPseudo')
 @DomName('Element.webkitPseudo')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 @Experimental // nonstandard
 String pseudo;

 @JSName('webkitRegionOverset')
 @DomName('Element.webkitRegionOverset')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // http://dev.w3.org/csswg/css-regions/#dom-region-regionoverset
 final String regionOverset;

 @JSName('webkitShadowRoot')
 @DomName('Element.webkitShadowRoot')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
 final ShadowRoot shadowRoot;

 @DomName('Element.blur')
 @DocsEditable
 void blur() native;

 @DomName('Element.focus')
 @DocsEditable
 void focus() native;

 @JSName('getAttribute')
 @DomName('Element.getAttribute')
 @DocsEditable
 String $dom_getAttribute(String name) native;

 @JSName('getAttributeNS')
 @DomName('Element.getAttributeNS')
 @DocsEditable
 String $dom_getAttributeNS(String namespaceURI, String localName) native;

 @DomName('Element.getBoundingClientRect')
 @DocsEditable
 Rect getBoundingClientRect() native;

 @DomName('Element.getClientRects')
 @DocsEditable
 @Returns('_ClientRectList')
 @Creates('_ClientRectList')
 List<Rect> getClientRects() native;

 @DomName('Element.getElementsByClassName')
 @DocsEditable
 @Returns('NodeList')
 @Creates('NodeList')
 List<Node> getElementsByClassName(String name) native;

 @JSName('getElementsByTagName')
 @DomName('Element.getElementsByTagName')
 @DocsEditable
 @Returns('NodeList')
 @Creates('NodeList')
 List<Node> $dom_getElementsByTagName(String name) native;

 @JSName('hasAttribute')
 @DomName('Element.hasAttribute')
 @DocsEditable
 bool $dom_hasAttribute(String name) native;

 @JSName('hasAttributeNS')
 @DomName('Element.hasAttributeNS')
 @DocsEditable
 bool $dom_hasAttributeNS(String namespaceURI, String localName) native;

 @JSName('querySelector')
 /**
* Finds the first descendant element of this element that matches the
* specified group of selectors.
*
* [selectors] should be a string using CSS selector syntax.
*
*     // Gets the first descendant with the class 'classname'
*     var element = element.query('.className');
*     // Gets the element with id 'id'
*     var element = element.query('#id');
*     // Gets the first descendant [ImageElement]
*     var img = element.query('img');
*
* See also:
*
* * [CSS Selectors](http://docs.webplatform.org/wiki/css/selectors)
*/
 @DomName('Element.querySelector')
 @DocsEditable
 Element query(String selectors) native;

 @JSName('querySelectorAll')
 @DomName('Element.querySelectorAll')
 @DocsEditable
 @Returns('NodeList')
 @Creates('NodeList')
 List<Node> $dom_querySelectorAll(String selectors) native;

 @JSName('removeAttribute')
 @DomName('Element.removeAttribute')
 @DocsEditable
 void $dom_removeAttribute(String name) native;

 @JSName('removeAttributeNS')
 @DomName('Element.removeAttributeNS')
 @DocsEditable
 void $dom_removeAttributeNS(String namespaceURI, String localName) native;

 @DomName('Element.scrollByLines')
 @DocsEditable
 void scrollByLines(int lines) native;

 @DomName('Element.scrollByPages')
 @DocsEditable
 void scrollByPages(int pages) native;

 @JSName('scrollIntoView')
 @DomName('Element.scrollIntoView')
 @DocsEditable
 void $dom_scrollIntoView([bool alignWithTop]) native;

 @JSName('scrollIntoViewIfNeeded')
 @DomName('Element.scrollIntoViewIfNeeded')
 @DocsEditable
 // http://docs.webplatform.org/wiki/dom/methods/scrollIntoViewIfNeeded
 @Experimental // non-standard
 void $dom_scrollIntoViewIfNeeded([bool centerIfNeeded]) native;

 @JSName('setAttribute')
 @DomName('Element.setAttribute')
 @DocsEditable
 void $dom_setAttribute(String name, String value) native;

 @JSName('setAttributeNS')
 @DomName('Element.setAttributeNS')
 @DocsEditable
 void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native;

 @JSName('webkitCreateShadowRoot')
 @DomName('Element.webkitCreateShadowRoot')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME, '25')
 @Experimental
 // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
 ShadowRoot createShadowRoot() native;

 @JSName('webkitGetRegionFlowRanges')
 @DomName('Element.webkitGetRegionFlowRanges')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // http://dev.w3.org/csswg/css-regions/#dom-region-getregionflowranges
 List<Range> getRegionFlowRanges() native;

 @JSName('webkitRequestFullScreen')
 @DomName('Element.webkitRequestFullScreen')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-element-requestfullscreen
 @deprecated // deprecated
 void requestFullScreen(int flags) native;

 @JSName('webkitRequestFullscreen')
 @DomName('Element.webkitRequestFullscreen')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-element-requestfullscreen
 void requestFullscreen() native;

 @JSName('webkitRequestPointerLock')
 @DomName('Element.webkitRequestPointerLock')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.SAFARI)
 @Experimental
 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#widl-Element-requestPointerLock-void
 void requestPointerLock() native;

 @DomName('Element.onabort')
 @DocsEditable
 Stream<Event> get onAbort => abortEvent.forTarget(this);

 @DomName('Element.onbeforecopy')
 @DocsEditable
 Stream<Event> get onBeforeCopy => beforeCopyEvent.forTarget(this);

 @DomName('Element.onbeforecut')
 @DocsEditable
 Stream<Event> get onBeforeCut => beforeCutEvent.forTarget(this);

 @DomName('Element.onbeforepaste')
 @DocsEditable
 Stream<Event> get onBeforePaste => beforePasteEvent.forTarget(this);

 @DomName('Element.onblur')
 @DocsEditable
 Stream<Event> get onBlur => blurEvent.forTarget(this);

 @DomName('Element.onchange')
 @DocsEditable
 Stream<Event> get onChange => changeEvent.forTarget(this);

 @DomName('Element.onclick')
 @DocsEditable
 Stream<MouseEvent> get onClick => clickEvent.forTarget(this);

 @DomName('Element.oncontextmenu')
 @DocsEditable
 Stream<MouseEvent> get onContextMenu => contextMenuEvent.forTarget(this);

 @DomName('Element.oncopy')
 @DocsEditable
 Stream<Event> get onCopy => copyEvent.forTarget(this);

 @DomName('Element.oncut')
 @DocsEditable
 Stream<Event> get onCut => cutEvent.forTarget(this);

 @DomName('Element.ondblclick')
 @DocsEditable
 Stream<Event> get onDoubleClick => doubleClickEvent.forTarget(this);

 @DomName('Element.ondrag')
 @DocsEditable
 Stream<MouseEvent> get onDrag => dragEvent.forTarget(this);

 @DomName('Element.ondragend')
 @DocsEditable
 Stream<MouseEvent> get onDragEnd => dragEndEvent.forTarget(this);

 @DomName('Element.ondragenter')
 @DocsEditable
 Stream<MouseEvent> get onDragEnter => dragEnterEvent.forTarget(this);

 @DomName('Element.ondragleave')
 @DocsEditable
 Stream<MouseEvent> get onDragLeave => dragLeaveEvent.forTarget(this);

 @DomName('Element.ondragover')
 @DocsEditable
 Stream<MouseEvent> get onDragOver => dragOverEvent.forTarget(this);

 @DomName('Element.ondragstart')
 @DocsEditable
 Stream<MouseEvent> get onDragStart => dragStartEvent.forTarget(this);

 @DomName('Element.ondrop')
 @DocsEditable
 Stream<MouseEvent> get onDrop => dropEvent.forTarget(this);

 @DomName('Element.onerror')
 @DocsEditable
 Stream<Event> get onError => errorEvent.forTarget(this);

 @DomName('Element.onfocus')
 @DocsEditable
 Stream<Event> get onFocus => focusEvent.forTarget(this);

 @DomName('Element.oninput')
 @DocsEditable
 Stream<Event> get onInput => inputEvent.forTarget(this);

 @DomName('Element.oninvalid')
 @DocsEditable
 Stream<Event> get onInvalid => invalidEvent.forTarget(this);

 @DomName('Element.onkeydown')
 @DocsEditable
 Stream<KeyboardEvent> get onKeyDown => keyDownEvent.forTarget(this);

 @DomName('Element.onkeypress')
 @DocsEditable
 Stream<KeyboardEvent> get onKeyPress => keyPressEvent.forTarget(this);

 @DomName('Element.onkeyup')
 @DocsEditable
 Stream<KeyboardEvent> get onKeyUp => keyUpEvent.forTarget(this);

 @DomName('Element.onload')
 @DocsEditable
 Stream<Event> get onLoad => loadEvent.forTarget(this);

 @DomName('Element.onmousedown')
 @DocsEditable
 Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);

 @DomName('Element.onmousemove')
 @DocsEditable
 Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);

 @DomName('Element.onmouseout')
 @DocsEditable
 Stream<MouseEvent> get onMouseOut => mouseOutEvent.forTarget(this);

 @DomName('Element.onmouseover')
 @DocsEditable
 Stream<MouseEvent> get onMouseOver => mouseOverEvent.forTarget(this);

 @DomName('Element.onmouseup')
 @DocsEditable
 Stream<MouseEvent> get onMouseUp => mouseUpEvent.forTarget(this);

 @DomName('Element.onmousewheel')
 @DocsEditable
 // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
 @Experimental // non-standard
 Stream<WheelEvent> get onMouseWheel => mouseWheelEvent.forTarget(this);

 @DomName('Element.onpaste')
 @DocsEditable
 Stream<Event> get onPaste => pasteEvent.forTarget(this);

 @DomName('Element.onreset')
 @DocsEditable
 Stream<Event> get onReset => resetEvent.forTarget(this);

 @DomName('Element.onscroll')
 @DocsEditable
 Stream<Event> get onScroll => scrollEvent.forTarget(this);

 @DomName('Element.onsearch')
 @DocsEditable
 // http://www.w3.org/TR/html-markup/input.search.html
 @Experimental
 Stream<Event> get onSearch => searchEvent.forTarget(this);

 @DomName('Element.onselect')
 @DocsEditable
 Stream<Event> get onSelect => selectEvent.forTarget(this);

 @DomName('Element.onselectstart')
 @DocsEditable
 @Experimental // nonstandard
 Stream<Event> get onSelectStart => selectStartEvent.forTarget(this);

 @DomName('Element.onsubmit')
 @DocsEditable
 Stream<Event> get onSubmit => submitEvent.forTarget(this);

 @DomName('Element.ontouchcancel')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchCancel => touchCancelEvent.forTarget(this);

 @DomName('Element.ontouchend')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchEnd => touchEndEvent.forTarget(this);

 @DomName('Element.ontouchenter')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchEnter => touchEnterEvent.forTarget(this);

 @DomName('Element.ontouchleave')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchLeave => touchLeaveEvent.forTarget(this);

 @DomName('Element.ontouchmove')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchMove => touchMoveEvent.forTarget(this);

 @DomName('Element.ontouchstart')
 @DocsEditable
 // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
 @Experimental
 Stream<TouchEvent> get onTouchStart => touchStartEvent.forTarget(this);

 @DomName('Element.ontransitionend')
 @DocsEditable
 @SupportedBrowser(SupportedBrowser.CHROME)
 @SupportedBrowser(SupportedBrowser.FIREFOX)
 @SupportedBrowser(SupportedBrowser.IE, '10')
 @SupportedBrowser(SupportedBrowser.SAFARI)
 Stream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forTarget(this);

 @DomName('Element.onwebkitfullscreenchange')
 @DocsEditable
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
 @Experimental
 Stream<Event> get onFullscreenChange => fullscreenChangeEvent.forTarget(this);

 @DomName('Element.onwebkitfullscreenerror')
 @DocsEditable
 // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
 @Experimental
 Stream<Event> get onFullscreenError => fullscreenErrorEvent.forTarget(this);

}

Extends

Interceptor > EventTarget > Node > Element

Subclasses

AnchorElement, AreaElement, BRElement, BaseElement, BodyElement, ButtonElement, CanvasElement, ContentElement, DListElement, DataListElement, DetailsElement, DialogElement, DivElement, EmbedElement, FieldSetElement, FormElement, HRElement, HeadElement, HeadingElement, HtmlElement, IFrameElement, ImageElement, InputElement, InputElementBase, KeygenElement, LIElement, LabelElement, LegendElement, LinkElement, MapElement, MediaElement, MenuElement, MetaElement, MeterElement, ModElement, OListElement, ObjectElement, OptGroupElement, OptionElement, OutputElement, ParagraphElement, ParamElement, PreElement, ProgressElement, QuoteElement, ScriptElement, SelectElement, ShadowElement, SourceElement, SpanElement, StyleElement, SvgElement, TableCaptionElement, TableCellElement, TableColElement, TableElement, TableRowElement, TableSectionElement, TemplateElement, TextAreaElement, TitleElement, TrackElement, UListElement, UnknownElement

Implements

ElementTraversal

Static Properties

const EventStreamProvider<Event> abortEvent #

static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort')

const int ALLOW_KEYBOARD_INPUT #

static const int ALLOW_KEYBOARD_INPUT = 1

const EventStreamProvider<Event> beforeCopyEvent #

static const EventStreamProvider<Event> beforeCopyEvent = const EventStreamProvider<Event>('beforecopy')

const EventStreamProvider<Event> beforeCutEvent #

static const EventStreamProvider<Event> beforeCutEvent = const EventStreamProvider<Event>('beforecut')

const EventStreamProvider<Event> beforePasteEvent #

static const EventStreamProvider<Event> beforePasteEvent = const EventStreamProvider<Event>('beforepaste')

const EventStreamProvider<Event> blurEvent #

static const EventStreamProvider<Event> blurEvent = const EventStreamProvider<Event>('blur')

const EventStreamProvider<Event> changeEvent #

static const EventStreamProvider<Event> changeEvent = const EventStreamProvider<Event>('change')

const EventStreamProvider<MouseEvent> clickEvent #

static const EventStreamProvider<MouseEvent> clickEvent = const EventStreamProvider<MouseEvent>('click')

const EventStreamProvider<MouseEvent> contextMenuEvent #

static const EventStreamProvider<MouseEvent> contextMenuEvent = const EventStreamProvider<MouseEvent>('contextmenu')

const EventStreamProvider<Event> copyEvent #

static const EventStreamProvider<Event> copyEvent = const EventStreamProvider<Event>('copy')

const EventStreamProvider<Event> cutEvent #

static const EventStreamProvider<Event> cutEvent = const EventStreamProvider<Event>('cut')

const EventStreamProvider<Event> doubleClickEvent #

static const EventStreamProvider<Event> doubleClickEvent = const EventStreamProvider<Event>('dblclick')

const EventStreamProvider<MouseEvent> dragEndEvent #

static const EventStreamProvider<MouseEvent> dragEndEvent = const EventStreamProvider<MouseEvent>('dragend')

const EventStreamProvider<MouseEvent> dragEnterEvent #

static const EventStreamProvider<MouseEvent> dragEnterEvent = const EventStreamProvider<MouseEvent>('dragenter')

const EventStreamProvider<MouseEvent> dragEvent #

static const EventStreamProvider<MouseEvent> dragEvent = const EventStreamProvider<MouseEvent>('drag')

const EventStreamProvider<MouseEvent> dragLeaveEvent #

static const EventStreamProvider<MouseEvent> dragLeaveEvent = const EventStreamProvider<MouseEvent>('dragleave')

const EventStreamProvider<MouseEvent> dragOverEvent #

static const EventStreamProvider<MouseEvent> dragOverEvent = const EventStreamProvider<MouseEvent>('dragover')

const EventStreamProvider<MouseEvent> dragStartEvent #

static const EventStreamProvider<MouseEvent> dragStartEvent = const EventStreamProvider<MouseEvent>('dragstart')

const EventStreamProvider<MouseEvent> dropEvent #

static const EventStreamProvider<MouseEvent> dropEvent = const EventStreamProvider<MouseEvent>('drop')

const EventStreamProvider<Event> errorEvent #

static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error')

const EventStreamProvider<Event> focusEvent #

static const EventStreamProvider<Event> focusEvent = const EventStreamProvider<Event>('focus')

const EventStreamProvider<Event> fullscreenChangeEvent #

static const EventStreamProvider<Event> fullscreenChangeEvent = const EventStreamProvider<Event>('webkitfullscreenchange')

const EventStreamProvider<Event> fullscreenErrorEvent #

static const EventStreamProvider<Event> fullscreenErrorEvent = const EventStreamProvider<Event>('webkitfullscreenerror')

const EventStreamProvider<Event> inputEvent #

static const EventStreamProvider<Event> inputEvent = const EventStreamProvider<Event>('input')

const EventStreamProvider<Event> invalidEvent #

static const EventStreamProvider<Event> invalidEvent = const EventStreamProvider<Event>('invalid')

const EventStreamProvider<KeyboardEvent> keyDownEvent #

static const EventStreamProvider<KeyboardEvent> keyDownEvent = const EventStreamProvider<KeyboardEvent>('keydown')

const EventStreamProvider<KeyboardEvent> keyPressEvent #

static const EventStreamProvider<KeyboardEvent> keyPressEvent = const EventStreamProvider<KeyboardEvent>('keypress')

const EventStreamProvider<KeyboardEvent> keyUpEvent #

static const EventStreamProvider<KeyboardEvent> keyUpEvent = const EventStreamProvider<KeyboardEvent>('keyup')

const EventStreamProvider<Event> loadEvent #

static const EventStreamProvider<Event> loadEvent = const EventStreamProvider<Event>('load')

const EventStreamProvider<MouseEvent> mouseDownEvent #

static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown')

const EventStreamProvider<MouseEvent> mouseMoveEvent #

static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove')

const EventStreamProvider<MouseEvent> mouseOutEvent #

static const EventStreamProvider<MouseEvent> mouseOutEvent = const EventStreamProvider<MouseEvent>('mouseout')

const EventStreamProvider<MouseEvent> mouseOverEvent #

static const EventStreamProvider<MouseEvent> mouseOverEvent = const EventStreamProvider<MouseEvent>('mouseover')

const EventStreamProvider<MouseEvent> mouseUpEvent #

static const EventStreamProvider<MouseEvent> mouseUpEvent = const EventStreamProvider<MouseEvent>('mouseup')

const EventStreamProvider<WheelEvent> mouseWheelEvent #

static const EventStreamProvider<WheelEvent> mouseWheelEvent =
   const _CustomEventStreamProvider<WheelEvent>(
     Element._determineMouseWheelEventType)

const EventStreamProvider<Event> pasteEvent #

static const EventStreamProvider<Event> pasteEvent = const EventStreamProvider<Event>('paste')

const EventStreamProvider<Event> resetEvent #

static const EventStreamProvider<Event> resetEvent = const EventStreamProvider<Event>('reset')

const EventStreamProvider<Event> scrollEvent #

static const EventStreamProvider<Event> scrollEvent = const EventStreamProvider<Event>('scroll')

const EventStreamProvider<Event> searchEvent #

static const EventStreamProvider<Event> searchEvent = const EventStreamProvider<Event>('search')

const EventStreamProvider<Event> selectEvent #

static const EventStreamProvider<Event> selectEvent = const EventStreamProvider<Event>('select')

const EventStreamProvider<Event> selectStartEvent #

static const EventStreamProvider<Event> selectStartEvent = const EventStreamProvider<Event>('selectstart')

const EventStreamProvider<Event> submitEvent #

static const EventStreamProvider<Event> submitEvent = const EventStreamProvider<Event>('submit')

const EventStreamProvider<TouchEvent> touchCancelEvent #

static const EventStreamProvider<TouchEvent> touchCancelEvent = const EventStreamProvider<TouchEvent>('touchcancel')

const EventStreamProvider<TouchEvent> touchEndEvent #

static const EventStreamProvider<TouchEvent> touchEndEvent = const EventStreamProvider<TouchEvent>('touchend')

const EventStreamProvider<TouchEvent> touchEnterEvent #

static const EventStreamProvider<TouchEvent> touchEnterEvent = const EventStreamProvider<TouchEvent>('touchenter')

const EventStreamProvider<TouchEvent> touchLeaveEvent #

static const EventStreamProvider<TouchEvent> touchLeaveEvent = const EventStreamProvider<TouchEvent>('touchleave')

const EventStreamProvider<TouchEvent> touchMoveEvent #

static const EventStreamProvider<TouchEvent> touchMoveEvent = const EventStreamProvider<TouchEvent>('touchmove')

const EventStreamProvider<TouchEvent> touchStartEvent #

static const EventStreamProvider<TouchEvent> touchStartEvent = const EventStreamProvider<TouchEvent>('touchstart')

const EventStreamProvider<TransitionEvent> transitionEndEvent #

static const EventStreamProvider<TransitionEvent> transitionEndEvent =
   const _CustomEventStreamProvider<TransitionEvent>(
     Element._determineTransitionEventType)

Static Methods

bool isTagSupported(String tag) #

Checks to see if the tag name is supported by the current platform.

The tag should be a valid HTML tag name.

static bool isTagSupported(String tag) {
 var e = _ElementFactoryProvider.createElement_tag(tag);
 return e is Element && !(e is UnknownElement);
}

Constructors

factory Element.html(String html) #

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.

var element = new Element.html('<div class="foo">content</div>');
factory Element.html(String html) =>
   _ElementFactoryProvider.createElement_html(html);

factory Element.tag(String tag) #

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 divElement = new Element.tag('div');
print(divElement is DivElement); // 'true'
var myElement = new Element.tag('unknownTag');
print(myElement is UnknownElement); // 'true'

For standard elements it is more preferable to use the type constructors:

var element = new DivElement();

See also:

factory Element.tag(String tag) =>
   _ElementFactoryProvider.createElement_tag(tag);

Properties

final _NamedNodeMap $dom_attributes #

All attributes associated with an element.
final _NamedNodeMap $dom_attributes

final int $dom_childElementCount #

The number of child nodes that are elements.
final int $dom_childElementCount

final List<Node> $dom_childNodes #

inherited from Node
final List<Node> $dom_childNodes

final HtmlCollection $dom_children #

A live nsIDOMNodeList of the current child elements.
final HtmlCollection $dom_children

String $dom_className #

Gets/sets the class of the element.
String $dom_className

final Node $dom_firstChild #

inherited from Node
final Node $dom_firstChild

final Element $dom_firstElementChild #

The first direct child element of an element, or null if the element has no child elements.
final Element $dom_firstElementChild

final Node $dom_lastChild #

inherited from Node
final Node $dom_lastChild

final Element $dom_lastElementChild #

The last direct child element of an element, or null if the element has no child elements.
final Element $dom_lastElementChild

final String $dom_localName #

inherited from Node
final String $dom_localName

final String $dom_namespaceUri #

inherited from Node
final String $dom_namespaceUri

Map<String, String> attributes #

All attributes on this element.

Any modifications to the attribute map will automatically be applied to this element.

This only includes attributes which are not in a namespace (such as 'xlink:href'), additional attributes can be accessed via getNamespacedAttributes.

Map<String, String> get attributes => new _ElementAttributeMap(this);
void set attributes(Map<String, String> value) {
 Map<String, String> attributes = this.attributes;
 attributes.clear();
 for (String key in value.keys) {
   attributes[key] = value[key];
 }
}

List<Element> children #

List of the direct children of this element.

This collection can be used to add and remove elements from the document.

var item = new DivElement();
item.text = 'Something';
document.body.children.add(item) // Item is now displayed on the page.
for (var element in document.body.children) {
  element.style.background = 'red'; // Turns every child of body red.
}
List<Element> get children => new _ChildrenElementList._wrap(this);
void set children(List<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);
}

CssClassSet classes #

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(Iterable<String> value) {
 CssClassSet classSet = classes;
 classSet.clear();
 classSet.addAll(value);
}

final Rect client #

Gets the position of this element relative to the client area of the page.

Rect get client => new Rect(clientLeft, clientTop, clientWidth, clientHeight);

final int clientHeight #

The inner height of an element.
final int clientHeight

final int clientLeft #

The width of the left border of an element.
final int clientLeft

final int clientTop #

The width of the top border of an element.
final int clientTop

final int clientWidth #

The inner width of an element.
final int clientWidth

final DocumentFragment content #

Gets the content of this template. This is only supported if isTemplate is true.

@Experimental
DocumentFragment get content {
 _ensureTemplate();
 return _templateContent;
}

String contentEditable #

Gets/sets whether or not the element is editable.
String contentEditable

Map<String, String> dataset #

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 capital letters.

Any keys from markup will be converted to camel-cased keys in the map.

For example, HTML specified as:

<div data-my-random-value='value'></div>

Would be accessed in Dart as:

var value = element.dataset['myRandomValue'];

See also:

Map<String, String> get dataset =>
 new _DataAttributeMap(attributes);
void set dataset(Map<String, String> value) {
 final data = this.dataset;
 data.clear();
 for (String key in value.keys) {
   data[key] = value[key];
 }
}

String dir #

Gets/sets the directionality of the element.
String dir

final Document document #

inherited from Node
final Document document

bool draggable #

bool draggable

String dropzone #

String dropzone

final int hashCode #

inherited from Interceptor

Get a hash code for this object.

All objects have hash codes. Hash codes are guaranteed to be the same for objects that are equal when compared using the equality operator ==. Other than that there are no guarantees about the hash codes. They will not be consistent between runs and there are no distribution guarantees.

If a subclass overrides hashCode it should override the equality operator as well to maintain consistency.

docs inherited from Object
int get hashCode => Primitives.objectHashCode(this);

bool hidden #

bool hidden

String id #

Gets/sets the id of the element.
String id

String innerHtml #

Gets/sets the markup of the element's content.
String innerHtml

final bool isContentEditable #

Indicates whether or not the content of the element can be edited. Read only.
final bool isContentEditable

final bool isTemplate #

Returns true if this node is a template.

A node is a template if tagName is TEMPLATE, or the node has the 'template' attribute and this tag supports attribute form for backwards compatibility with existing HTML parsers. The nodes that can use attribute form are table elments (THEAD, TBODY, TFOOT, TH, TR, TD, CAPTION, COLGROUP and COL) and OPTION.

@Experimental
bool get isTemplate => tagName == 'TEMPLATE' || _isAttributeTemplate;

String lang #

Gets/sets the language of an element's attributes, text, and element contents.
String lang

final String localName #

The local part of the qualified name of an element. In Firefox 3.5 and earlier, the property upper-cases the local name for HTML elements (but not XHTML elements). In later versions, this does not happen, so the property is in lower case for both HTML and XHTML. Requires Gecko 1.9.2
@DomName('Element.localName')
@DocsEditable
String get localName => $dom_localName;

var model #

The data model which is inherited through the tree. This is only supported if isTemplate is true.

Setting this will destructive propagate the value to all descendant nodes, and reinstantiate all of the nodes expanded by this template.

Currently this does not support propagation through Shadow DOMs.

@Experimental
get model => _model;
@Experimental
void set model(value) {
 _ensureTemplate();

 var syntax = TemplateElement.syntax[attributes['syntax']];
 _model = value;
 _Bindings._addBindings(this, model, syntax);
}

final String namespaceUri #

@DomName('Element.namespaceUri')
@DocsEditable
String get namespaceUri => $dom_namespaceUri;

final Element nextElementSibling #

The element immediately following the given one in the tree, or null if there's no sibling node.
final Element nextElementSibling

final Node nextNode #

inherited from Node
final Node nextNode

List<Node> nodes #

inherited from Node
List<Node> get nodes {
 return new _ChildNodeListLazy(this);
}
void set nodes(Iterable<Node> value) {
 // Copy list first since we don't want liveness during iteration.
 // TODO(jacobr): there is a better way to do this.
 List copy = new List.from(value);
 text = '';
 for (Node node in copy) {
   append(node);
 }
}

final int nodeType #

inherited from Node
final int nodeType

final String nodeValue #

inherited from Node
final String nodeValue

final Rect offset #

Gets the offset of this element relative to its offsetParent.

Rect get offset => new Rect(offsetLeft, offsetTop, offsetWidth, offsetHeight);

final int offsetHeight #

The height of an element, relative to the layout.
final int offsetHeight

final int offsetLeft #

The distance from this element's left border to its offsetParent's left border.
final int offsetLeft

final Element offsetParent #

The element from which all offset calculations are currently computed.
final Element offsetParent

final int offsetTop #

The distance from this element's top border to its offsetParent's top border.
final int offsetTop

final int offsetWidth #

The width of an element, relative to the layout.
final int offsetWidth

final Events on #

inherited from EventTarget

This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.

Events get on => new Events(this);

final Stream<Event> onAbort #

@DomName('Element.onabort')
@DocsEditable
Stream<Event> get onAbort => abortEvent.forTarget(this);

final Stream<Event> onBeforeCopy #

@DomName('Element.onbeforecopy')
@DocsEditable
Stream<Event> get onBeforeCopy => beforeCopyEvent.forTarget(this);

final Stream<Event> onBeforeCut #

@DomName('Element.onbeforecut')
@DocsEditable
Stream<Event> get onBeforeCut => beforeCutEvent.forTarget(this);

final Stream<Event> onBeforePaste #

@DomName('Element.onbeforepaste')
@DocsEditable
Stream<Event> get onBeforePaste => beforePasteEvent.forTarget(this);

final Stream<Event> onBlur #

Returns the event handling code for the blur event.
@DomName('Element.onblur')
@DocsEditable
Stream<Event> get onBlur => blurEvent.forTarget(this);

final Stream<Event> onChange #

Returns the event handling code for the change event.
@DomName('Element.onchange')
@DocsEditable
Stream<Event> get onChange => changeEvent.forTarget(this);

final Stream<MouseEvent> onClick #

Returns the event handling code for the click event.
@DomName('Element.onclick')
@DocsEditable
Stream<MouseEvent> get onClick => clickEvent.forTarget(this);

final Stream<MouseEvent> onContextMenu #

Returns the event handling code for the contextmenu event.
@DomName('Element.oncontextmenu')
@DocsEditable
Stream<MouseEvent> get onContextMenu => contextMenuEvent.forTarget(this);

final Stream<Event> onCopy #

Returns the event handling code for the copy event.
@DomName('Element.oncopy')
@DocsEditable
Stream<Event> get onCopy => copyEvent.forTarget(this);

final Stream<Event> onCut #

Returns the event handling code for the cut event.
@DomName('Element.oncut')
@DocsEditable
Stream<Event> get onCut => cutEvent.forTarget(this);

final Stream<Event> onDoubleClick #

Returns the event handling code for the dblclick event.
@DomName('Element.ondblclick')
@DocsEditable
Stream<Event> get onDoubleClick => doubleClickEvent.forTarget(this);

final Stream<MouseEvent> onDrag #

@DomName('Element.ondrag')
@DocsEditable
Stream<MouseEvent> get onDrag => dragEvent.forTarget(this);

final Stream<MouseEvent> onDragEnd #

@DomName('Element.ondragend')
@DocsEditable
Stream<MouseEvent> get onDragEnd => dragEndEvent.forTarget(this);

final Stream<MouseEvent> onDragEnter #

@DomName('Element.ondragenter')
@DocsEditable
Stream<MouseEvent> get onDragEnter => dragEnterEvent.forTarget(this);

final Stream<MouseEvent> onDragLeave #

@DomName('Element.ondragleave')
@DocsEditable
Stream<MouseEvent> get onDragLeave => dragLeaveEvent.forTarget(this);

final Stream<MouseEvent> onDragOver #

@DomName('Element.ondragover')
@DocsEditable
Stream<MouseEvent> get onDragOver => dragOverEvent.forTarget(this);

final Stream<MouseEvent> onDragStart #

@DomName('Element.ondragstart')
@DocsEditable
Stream<MouseEvent> get onDragStart => dragStartEvent.forTarget(this);

final Stream<MouseEvent> onDrop #

@DomName('Element.ondrop')
@DocsEditable
Stream<MouseEvent> get onDrop => dropEvent.forTarget(this);

final Stream<Event> onError #

@DomName('Element.onerror')
@DocsEditable
Stream<Event> get onError => errorEvent.forTarget(this);

final Stream<Event> onFocus #

Returns the event handling code for the focus event.
@DomName('Element.onfocus')
@DocsEditable
Stream<Event> get onFocus => focusEvent.forTarget(this);

final Stream<Event> onFullscreenChange #

@DomName('Element.onwebkitfullscreenchange')
@DocsEditable
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental
Stream<Event> get onFullscreenChange => fullscreenChangeEvent.forTarget(this);

final Stream<Event> onFullscreenError #

@DomName('Element.onwebkitfullscreenerror')
@DocsEditable
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental
Stream<Event> get onFullscreenError => fullscreenErrorEvent.forTarget(this);

final Stream<Event> onInput #

@DomName('Element.oninput')
@DocsEditable
Stream<Event> get onInput => inputEvent.forTarget(this);

final Stream<Event> onInvalid #

@DomName('Element.oninvalid')
@DocsEditable
Stream<Event> get onInvalid => invalidEvent.forTarget(this);

final Stream<KeyboardEvent> onKeyDown #

Returns the event handling code for the keydown event.
@DomName('Element.onkeydown')
@DocsEditable
Stream<KeyboardEvent> get onKeyDown => keyDownEvent.forTarget(this);

final Stream<KeyboardEvent> onKeyPress #

Returns the event handling code for the keypress event.
@DomName('Element.onkeypress')
@DocsEditable
Stream<KeyboardEvent> get onKeyPress => keyPressEvent.forTarget(this);

final Stream<KeyboardEvent> onKeyUp #

Returns the event handling code for the keyup event.
@DomName('Element.onkeyup')
@DocsEditable
Stream<KeyboardEvent> get onKeyUp => keyUpEvent.forTarget(this);

final Stream<Event> onLoad #

@DomName('Element.onload')
@DocsEditable
Stream<Event> get onLoad => loadEvent.forTarget(this);

final Stream<MouseEvent> onMouseDown #

Returns the event handling code for the mousedown event.
@DomName('Element.onmousedown')
@DocsEditable
Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);

final Stream<MouseEvent> onMouseMove #

Returns the event handling code for the mousemove event.
@DomName('Element.onmousemove')
@DocsEditable
Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);

final Stream<MouseEvent> onMouseOut #

Returns the event handling code for the mouseout event.
@DomName('Element.onmouseout')
@DocsEditable
Stream<MouseEvent> get onMouseOut => mouseOutEvent.forTarget(this);

final Stream<MouseEvent> onMouseOver #

Returns the event handling code for the mouseover event.
@DomName('Element.onmouseover')
@DocsEditable
Stream<MouseEvent> get onMouseOver => mouseOverEvent.forTarget(this);

final Stream<MouseEvent> onMouseUp #

Returns the event handling code for the mouseup event.
@DomName('Element.onmouseup')
@DocsEditable
Stream<MouseEvent> get onMouseUp => mouseUpEvent.forTarget(this);

final Stream<WheelEvent> onMouseWheel #

@DomName('Element.onmousewheel')
@DocsEditable
// http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
@Experimental // non-standard
Stream<WheelEvent> get onMouseWheel => mouseWheelEvent.forTarget(this);

final Stream<Event> onPaste #

Returns the event handling code for the paste event.
@DomName('Element.onpaste')
@DocsEditable
Stream<Event> get onPaste => pasteEvent.forTarget(this);

final Stream<Event> onReset #

@DomName('Element.onreset')
@DocsEditable
Stream<Event> get onReset => resetEvent.forTarget(this);

final Stream<Event> onScroll #

Returns the event handling code for the scroll event.
@DomName('Element.onscroll')
@DocsEditable
Stream<Event> get onScroll => scrollEvent.forTarget(this);

final Stream<Event> onSearch #

@DomName('Element.onsearch')
@DocsEditable
// http://www.w3.org/TR/html-markup/input.search.html
@Experimental
Stream<Event> get onSearch => searchEvent.forTarget(this);

final Stream<Event> onSelect #

@DomName('Element.onselect')
@DocsEditable
Stream<Event> get onSelect => selectEvent.forTarget(this);

final Stream<Event> onSelectStart #

@DomName('Element.onselectstart')
@DocsEditable
@Experimental // nonstandard
Stream<Event> get onSelectStart => selectStartEvent.forTarget(this);

final Stream<Event> onSubmit #

@DomName('Element.onsubmit')
@DocsEditable
Stream<Event> get onSubmit => submitEvent.forTarget(this);

final Stream<TouchEvent> onTouchCancel #

@DomName('Element.ontouchcancel')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchCancel => touchCancelEvent.forTarget(this);

final Stream<TouchEvent> onTouchEnd #

@DomName('Element.ontouchend')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchEnd => touchEndEvent.forTarget(this);

final Stream<TouchEvent> onTouchEnter #

@DomName('Element.ontouchenter')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchEnter => touchEnterEvent.forTarget(this);

final Stream<TouchEvent> onTouchLeave #

@DomName('Element.ontouchleave')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchLeave => touchLeaveEvent.forTarget(this);

final Stream<TouchEvent> onTouchMove #

@DomName('Element.ontouchmove')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchMove => touchMoveEvent.forTarget(this);

final Stream<TouchEvent> onTouchStart #

@DomName('Element.ontouchstart')
@DocsEditable
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental
Stream<TouchEvent> get onTouchStart => touchStartEvent.forTarget(this);

final Stream<TransitionEvent> onTransitionEnd #

@DomName('Element.ontransitionend')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
Stream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forTarget(this);

final String outerHtml #

Gets the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.
final String outerHtml

final Element parent #

inherited from Node
final Element parent

final Node parentNode #

inherited from Node
final Node parentNode

final Element previousElementSibling #

The element immediately preceding the given one in the tree, or null if there is no sibling element.
final Element previousElementSibling

final Node previousNode #

inherited from Node
final Node previousNode

String pseudo #

String pseudo

final Element ref #

Gets the template this node refers to. This is only supported if isTemplate is true.

@Experimental
Element get ref {
 _ensureTemplate();

 Element ref = null;
 var refId = attributes['ref'];
 if (refId != null) {
   ref = document.getElementById(refId);
 }

 return ref != null ? ref : _templateInstanceRef;
}

final String regionOverset #

final String regionOverset

final Type runtimeType #

inherited from Interceptor

A representation of the runtime type of the object.

docs inherited from Object
Type get runtimeType => getRuntimeType(this);

final int scrollHeight #

The scroll view height of an element.
final int scrollHeight

int scrollLeft #

Gets/sets the left scroll offset of an element.
int scrollLeft

int scrollTop #

Gets/sets the top scroll offset of an element.
int scrollTop

final int scrollWidth #

The scroll view width of an element.
final int scrollWidth

final ShadowRoot shadowRoot #

final ShadowRoot shadowRoot

bool spellcheck #

Controls spell-checking (present on all HTML elements)
bool spellcheck

final CssStyleDeclaration style #

An object representing the declarations of an element's style attributes.
final CssStyleDeclaration style

int tabIndex #

Gets/sets the position of the element in the tabbing order.
int tabIndex

final String tagName #

The name of the tag for the given element.
final String tagName

final TemplateInstance templateInstance #

inherited from Node

Gets the template instance that instantiated this node, if any.

@Experimental
TemplateInstance get templateInstance =>
   _templateInstance != null ? _templateInstance :
   (parent != null ? parent.templateInstance : null);

String text #

inherited from Node
String text

String title #

A string that appears in a popup box when mouse is over the element.
String title

bool translate #

bool translate

var xtag #

Experimental support for web components. This field stores a reference to the component implementation. It was inspired by Mozilla's x-tags project. Please note: in the future it may be possible to extend Element from your class, in which case this field will be deprecated.

If xtag has not been set, it will simply return this Element.

get xtag => _xtag != null ? _xtag : this;
void set xtag(Element value) {
 _xtag = value;
}

Operators

bool operator ==(other) #

inherited from Interceptor

The equality operator.

The default behavior for all Objects is to return true if and only if this and other are the same object.

If a subclass overrides the equality operator it should override the hashCode method as well to maintain consistency.

docs inherited from Object
bool operator ==(other) => identical(this, other);

Methods

Node append(Node newChild) #

inherited from Node

Adds a node to the end of the child nodes list of this node.

If the node already exists in this document, it will be removed from its current parent node, then added to this node.

This method is more efficient than nodes.add, and is the preferred way of appending a child node.

@JSName('appendChild')
/**
* Adds a node to the end of the child [nodes] list of this node.
*
* If the node already exists in this document, it will be removed from its
* current parent node, then added to this node.
*
* This method is more efficient than `nodes.add`, and is the preferred
* way of appending a child node.
*/
@DomName('Node.appendChild')
@DocsEditable
Node append(Node newChild) native;

void appendHtml(String text) #

Parses the specified text as HTML and adds the resulting node after the last child of this element.

void appendHtml(String text) {
 this.insertAdjacentHtml('beforeend', text);
}

void appendText(String text) #

Adds the specified text as a text node after the last child of this element.

void appendText(String text) {
 this.insertAdjacentText('beforeend', text);
}

void bind(String name, model, String path) #

Binds the attribute name to the path of the model. Path is a String of accessors such as foo.bar.baz.

docs inherited from Node
@Experimental
void bind(String name, model, String path) {
 _bindElement(this, name, model, path);
}

void blur() #

Removes keyboard focus from the current element.
@DomName('Element.blur')
@DocsEditable
void blur() native;

void click() #

Simulates a click on the current element.
@DomName('Element.click')
@DocsEditable
void click() native;

Node clone(bool deep) #

inherited from Node
@JSName('cloneNode')
@DomName('Node.cloneNode')
@DocsEditable
Node clone(bool deep) native;

bool contains(Node other) #

inherited from Node
@DomName('Node.contains')
@DocsEditable
bool contains(Node other) native;

DocumentFragment createInstance() #

Creates an instance of the template. This is only supported if isTemplate is true.

@Experimental
DocumentFragment createInstance() {
 _ensureTemplate();

 var template = ref;
 if (template == null) template = this;

 var instance = _Bindings._createDeepCloneAndDecorateTemplates(
     template.content, attributes['syntax']);

 if (TemplateElement._instanceCreated != null) {
   TemplateElement._instanceCreated.add(instance);
 }
 return instance;
}

ShadowRoot createShadowRoot() #

@JSName('webkitCreateShadowRoot')
@DomName('Element.webkitCreateShadowRoot')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME, '25')
@Experimental
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
ShadowRoot createShadowRoot() native;

bool dispatchEvent(Event event) #

inherited from Node
@DomName('Node.dispatchEvent')
@DocsEditable
bool dispatchEvent(Event event) native;

void focus() #

Gives keyboard focus to the current element.
@DomName('Element.focus')
@DocsEditable
void focus() native;

Rect getBoundingClientRect() #

@DomName('Element.getBoundingClientRect')
@DocsEditable
Rect getBoundingClientRect() native;

List<Rect> getClientRects() #

@DomName('Element.getClientRects')
@DocsEditable
@Returns('_ClientRectList')
@Creates('_ClientRectList')
List<Rect> getClientRects() native;

CssStyleDeclaration getComputedStyle([String pseudoElement]) #

The set of all CSS values applied to this element, including inherited and default values.

The computedStyle contains values that are inherited from other sources, such as parent elements or stylesheets. This differs from the style property, which contains only the values specified directly on this element.

PseudoElement can be values such as ::after, ::before, ::marker, ::line-marker.

See also:

CssStyleDeclaration getComputedStyle([String pseudoElement]) {
 if (pseudoElement == null) {
   pseudoElement = '';
 }
 // TODO(jacobr): last param should be null, see b/5045788
 return window.$dom_getComputedStyle(this, pseudoElement);
}

List<Node> getElementsByClassName(String name) #

@DomName('Element.getElementsByClassName')
@DocsEditable
@Returns('NodeList')
@Creates('NodeList')
List<Node> getElementsByClassName(String name) native;

InputMethodContext getInputContext() #

@DomName('Element.getInputContext')
@DocsEditable
// http://www.w3.org/TR/ime-api/#the-getinputcontext-method
@Experimental
InputMethodContext getInputContext() native;

Map<String, String> getNamespacedAttributes(String namespace) #

Gets a map for manipulating the attributes of a particular namespace.

This is primarily useful for SVG attributes such as xref:link.

Map<String, String> getNamespacedAttributes(String namespace) {
 return new _NamespacedAttributeMap(this, namespace);
}

List<Range> getRegionFlowRanges() #

@JSName('webkitGetRegionFlowRanges')
@DomName('Element.webkitGetRegionFlowRanges')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
// http://dev.w3.org/csswg/css-regions/#dom-region-getregionflowranges
List<Range> getRegionFlowRanges() native;

bool hasChildNodes() #

inherited from Node
@DomName('Node.hasChildNodes')
@DocsEditable
bool hasChildNodes() native;

Element insertAdjacentElement(String where, Element element) #

Inserts element into the DOM at the specified location.

To see the possible values for where, read the doc for insertAdjacentHtml.

See also:

Element insertAdjacentElement(String where, Element element) {
 if (JS('bool', '!!#.insertAdjacentElement', this)) {
   _insertAdjacentElement(where, element);
 } else {
   _insertAdjacentNode(where, element);
 }
 return element;
}

void insertAdjacentHtml(String where, String html) #

Parses text as an HTML fragment and inserts it into the DOM at the specified location.

The where parameter indicates where to insert the HTML fragment:

  • 'beforeBegin': Immediately before this element.
  • 'afterBegin': As the first child of this element.
  • 'beforeEnd': As the last child of this element.
  • 'afterEnd': Immediately after this element.

    var html = '<div class="something">content</div>'; // Inserts as the first child document.body.insertAdjacentHtml('afterBegin', html); var createdElement = document.body.children0; print(createdElement.classes0); // Prints 'something'

See also:

void insertAdjacentHtml(String where, String html) {
 if (JS('bool', '!!#.insertAdjacentHTML', this)) {
   _insertAdjacentHtml(where, html);
 } else {
   _insertAdjacentNode(where, new DocumentFragment.html(html));
 }
}

void insertAdjacentText(String where, String text) #

Creates a text node and inserts it into the DOM at the specified location.

To see the possible values for where, read the doc for insertAdjacentHtml.

See also:

void insertAdjacentText(String where, String text) {
 if (JS('bool', '!!#.insertAdjacentText', this)) {
   _insertAdjacentText(where, text);
 } else {
   _insertAdjacentNode(where, new Text(text));
 }
}

Node insertAllBefore(Iterable<Node> newNodes, Node refChild) #

inherited from Node

Inserts all of the nodes into this node directly before refChild.

See also:

  • insertBefore
Node insertAllBefore(Iterable<Node> newNodes, Node refChild) {
 if (newNodes is _ChildNodeListLazy) {
   _ChildNodeListLazy otherList = newNodes;
   if (identical(otherList._this, this)) {
     throw new ArgumentError(newNodes);
   }

   // Optimized route for copying between nodes.
   for (var i = 0, len = otherList.length; i < len; ++i) {
     // Should use $dom_firstChild, Bug 8886.
     this.insertBefore(otherList[0], refChild);
   }
 } else {
   for (var node in newNodes) {
     this.insertBefore(node, refChild);
   }
 }
}

Node insertBefore(Node newChild, Node refChild) #

inherited from Node
@DomName('Node.insertBefore')
@DocsEditable
Node insertBefore(Node newChild, Node refChild) native;

bool matches(String selectors) #

Checks if this element matches the CSS selectors.

@Experimental
bool matches(String selectors) {
 if (JS('bool', '!!#.matches', this)) {
   return JS('bool', '#.matches(#)', this, selectors);
 } else if (JS('bool', '!!#.webkitMatchesSelector', this)) {
   return JS('bool', '#.webkitMatchesSelector(#)', this, selectors);
 } else if (JS('bool', '!!#.mozMatchesSelector', this)) {
   return JS('bool', '#.mozMatchesSelector(#)', this, selectors);
 } else if (JS('bool', '!!#.msMatchesSelector', this)) {
   return JS('bool', '#.msMatchesSelector(#)', this, selectors);
 }
 throw new UnsupportedError("Not supported on this platform");
}

dynamic noSuchMethod(Invocation invocation) #

inherited from Interceptor

noSuchMethod is invoked when users invoke a non-existant method on an object. The name of the method and the arguments of the invocation are passed to noSuchMethod in an Invocation. If noSuchMethod returns a value, that value becomes the result of the original invocation.

The default behavior of noSuchMethod is to throw a noSuchMethodError.

docs inherited from Object
dynamic noSuchMethod(Invocation invocation) {
 throw new NoSuchMethodError(
     this,
     _symbolToString(invocation.memberName),
     invocation.positionalArguments,
     _symbolMapToStringMap(invocation.namedArguments));
}

void onCreated() #

Called by the DOM when this element has been instantiated.

@Experimental
void onCreated() {}

Element query(String selectors) #

Finds the first descendant element of this element that matches the specified group of selectors.

selectors should be a string using CSS selector syntax.

// Gets the first descendant with the class 'classname'
var element = element.query('.className');
// Gets the element with id 'id'
var element = element.query('#id');
// Gets the first descendant [ImageElement]
var img = element.query('img');

See also:

@JSName('querySelector')
/**
* Finds the first descendant element of this element that matches the
* specified group of selectors.
*
* [selectors] should be a string using CSS selector syntax.
*
*     // Gets the first descendant with the class 'classname'
*     var element = element.query('.className');
*     // Gets the element with id 'id'
*     var element = element.query('#id');
*     // Gets the first descendant [ImageElement]
*     var img = element.query('img');
*
* See also:
*
* * [CSS Selectors](http://docs.webplatform.org/wiki/css/selectors)
*/
@DomName('Element.querySelector')
@DocsEditable
Element query(String selectors) native;

ElementList queryAll(String 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');
ElementList queryAll(String selectors) =>
 new _FrozenElementList._wrap($dom_querySelectorAll(selectors));

void remove() #

inherited from Node

Removes this node from the DOM.

@DomName('Node.removeChild')
void remove() {
 // TODO(jacobr): should we throw an exception if parent is already null?
 // TODO(vsm): Use the native remove when available.
 if (this.parentNode != null) {
   final Node parent = this.parentNode;
   parentNode.$dom_removeChild(this);
 }
}

Node replaceWith(Node otherNode) #

inherited from Node

Replaces this node with another node.

@DomName('Node.replaceChild')
Node replaceWith(Node otherNode) {
 try {
   final Node parent = this.parentNode;
   parent.$dom_replaceChild(otherNode, this);
 } catch (e) {

 };
 return this;
}

void requestFullScreen(int flags) #

Asynchronously asks the browser to make the element full-screen.
@JSName('webkitRequestFullScreen')
@DomName('Element.webkitRequestFullScreen')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-element-requestfullscreen
@deprecated // deprecated
void requestFullScreen(int flags) native;

void requestFullscreen() #

@JSName('webkitRequestFullscreen')
@DomName('Element.webkitRequestFullscreen')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-element-requestfullscreen
void requestFullscreen() native;

void requestPointerLock() #

@JSName('webkitRequestPointerLock')
@DomName('Element.webkitRequestPointerLock')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
// https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#widl-Element-requestPointerLock-void
void requestPointerLock() native;

void scrollByLines(int lines) #

@DomName('Element.scrollByLines')
@DocsEditable
void scrollByLines(int lines) native;

void scrollByPages(int pages) #

@DomName('Element.scrollByPages')
@DocsEditable
void scrollByPages(int pages) native;

void scrollIntoView([ScrollAlignment alignment]) #

Scrolls this element into view.

Only one of of the alignment options may be specified at a time.

If no options are specified then this will attempt to scroll the minimum amount needed to bring the element into view.

Note that alignCenter is currently only supported on WebKit platforms. If alignCenter is specified but not supported then this will fall back to alignTop.

See also:

void scrollIntoView([ScrollAlignment alignment]) {
 var hasScrollIntoViewIfNeeded = false;
 hasScrollIntoViewIfNeeded =
     JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
 if (alignment == ScrollAlignment.TOP) {
   this.$dom_scrollIntoView(true);
 } else if (alignment == ScrollAlignment.BOTTOM) {
   this.$dom_scrollIntoView(false);
 } else if (hasScrollIntoViewIfNeeded) {
   if (alignment == ScrollAlignment.CENTER) {
     this.$dom_scrollIntoViewIfNeeded(true);
   } else {
     this.$dom_scrollIntoViewIfNeeded();
   }
 } else {
   this.$dom_scrollIntoView();
 }
}

String toString() #

Print out a String representation of this Node.

docs inherited from Node
String toString() => localName;

void unbind(String name) #

Unbinds the attribute name.

docs inherited from Node
@Experimental
void unbind(String name) {
 _unbindElement(this, name);
}

void unbindAll() #

Unbinds all bound attributes.

docs inherited from Node
@Experimental
void unbindAll() {
 _unbindAllElement(this);
}

void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) #

inherited from Node
@JSName('addEventListener')
@DomName('Node.addEventListener')
@DocsEditable
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;

String $dom_getAttribute(String name) #

Retrieve the value of the named attribute from the current node.
@JSName('getAttribute')
@DomName('Element.getAttribute')
@DocsEditable
String $dom_getAttribute(String name) native;

String $dom_getAttributeNS(String namespaceURI, String localName) #

Retrieve the value of the attribute with the specified name and namespace, from the current node.
@JSName('getAttributeNS')
@DomName('Element.getAttributeNS')
@DocsEditable
String $dom_getAttributeNS(String namespaceURI, String localName) native;

List<Node> $dom_getElementsByTagName(String name) #

Retrieve a set of all descendant elements, of a particular tag name, from the current element.
@JSName('getElementsByTagName')
@DomName('Element.getElementsByTagName')
@DocsEditable
@Returns('NodeList')
@Creates('NodeList')
List<Node> $dom_getElementsByTagName(String name) native;

bool $dom_hasAttribute(String name) #

Check if the element has the specified attribute, or not.
@JSName('hasAttribute')
@DomName('Element.hasAttribute')
@DocsEditable
bool $dom_hasAttribute(String name) native;

bool $dom_hasAttributeNS(String namespaceURI, String localName) #

Check if the element has the specified attribute, in the specified namespace, or not.
@JSName('hasAttributeNS')
@DomName('Element.hasAttributeNS')
@DocsEditable
bool $dom_hasAttributeNS(String namespaceURI, String localName) native;

List<Node> $dom_querySelectorAll(String selectors) #

@JSName('querySelectorAll')
@DomName('Element.querySelectorAll')
@DocsEditable
@Returns('NodeList')
@Creates('NodeList')
List<Node> $dom_querySelectorAll(String selectors) native;

void $dom_removeAttribute(String name) #

Remove the named attribute from the current node.
@JSName('removeAttribute')
@DomName('Element.removeAttribute')
@DocsEditable
void $dom_removeAttribute(String name) native;

void $dom_removeAttributeNS(String namespaceURI, String localName) #

Remove the attribute with the specified name and namespace, from the current node.
@JSName('removeAttributeNS')
@DomName('Element.removeAttributeNS')
@DocsEditable
void $dom_removeAttributeNS(String namespaceURI, String localName) native;

Node $dom_removeChild(Node oldChild) #

inherited from Node
@JSName('removeChild')
@DomName('Node.removeChild')
@DocsEditable
Node $dom_removeChild(Node oldChild) native;

void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) #

inherited from Node
@JSName('removeEventListener')
@DomName('Node.removeEventListener')
@DocsEditable
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;

Node $dom_replaceChild(Node newChild, Node oldChild) #

inherited from Node
@JSName('replaceChild')
@DomName('Node.replaceChild')
@DocsEditable
Node $dom_replaceChild(Node newChild, Node oldChild) native;

void $dom_scrollIntoView([bool alignWithTop]) #

Scrolls the page until the element gets into the view.
@JSName('scrollIntoView')
@DomName('Element.scrollIntoView')
@DocsEditable
void $dom_scrollIntoView([bool alignWithTop]) native;

void $dom_scrollIntoViewIfNeeded([bool centerIfNeeded]) #

@JSName('scrollIntoViewIfNeeded')
@DomName('Element.scrollIntoViewIfNeeded')
@DocsEditable
// http://docs.webplatform.org/wiki/dom/methods/scrollIntoViewIfNeeded
@Experimental // non-standard
void $dom_scrollIntoViewIfNeeded([bool centerIfNeeded]) native;

void $dom_setAttribute(String name, String value) #

Set the value of the named attribute from the current node.
@JSName('setAttribute')
@DomName('Element.setAttribute')
@DocsEditable
void $dom_setAttribute(String name, String value) native;

void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) #

Set the value of the attribute with the specified name and namespace, from the current node.
@JSName('setAttributeNS')
@DomName('Element.setAttributeNS')
@DocsEditable
void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native;

This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.