Dart API Referencedart:htmlElement

Element Interface

This chapter provides a brief reference for the general methods, properties, and events available to most HTML and XML elements in the Gecko DOM.

Various W3C specifications apply to elements:

The articles listed here span the above and include links to the appropriate W3C DOM specification.

While these interfaces are generally shared by most HTML and XML elements, there are more specialized interfaces for particular objects listed in the DOM HTML Specification. Note, however, that these HTML interfaces are "only for [HTML 4.01] and [XHTML 1.0] documents and are not guaranteed to work with any future version of XHTML." The HTML 5 draft does state it aims for backwards compatibility with these HTML interfaces but says of them that "some features that were formerly deprecated, poorly supported, rarely used or considered unnecessary have been removed." One can avoid the potential conflict by moving entirely to DOM XML attribute methods such as getAttribute().

Html , Head , Link , Title , Meta , Base , IsIndex , Style , Body , Form , Select , OptGroup , Option, Input , TextArea , Button , Label , FieldSet , Legend , UList , OList , DList , Directory , Menu , LI , Div , Paragraph , Heading , Quote , Pre , BR , BaseFont , Font , HR , Mod , Anchor , Image , Object , Param , Applet , Map , Area , Script , Table , TableCaption , TableCol , TableSection , TableRow , TableCell , FrameSet , Frame , IFrame

Extends

NodeSelector, Node

Subinterfaces

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

Constructors

Code new Element.html(String html) #

Element.html(String html);

Code new Element.tag(String tag) #

Element.tag(String tag);

Static Fields

Code final int ALLOW_KEYBOARD_INPUT #

static final int ALLOW_KEYBOARD_INPUT = 1;

Methods

Code AttributeMap get attributes() #

AttributeMap get attributes();

Code void set attributes(Map<String, String> value) #

void set attributes(Map<String, String> value);

Code void blur() #

Removes keyboard focus from the current element.
void blur();

Code void set classes(Collection<String> value) #

void set classes(Collection<String> value);

Code Set<String> get classes() #

Set<String> get classes();

Code void click() #

Simulates a click on the current element.
void click();

Code Element clone(bool deep) #

Element clone(bool deep);

Code Future<CSSStyleDeclaration> get computedStyle() #

Future<CSSStyleDeclaration> get computedStyle();

Code AttributeMap get dataAttributes() #

AttributeMap get dataAttributes();

Code void set dataAttributes(Map<String, String> value) #

void set dataAttributes(Map<String, String> value);

Code ElementList get elements() #

ElementList get elements();

Code void set elements(Collection<Element> value) #

void set elements(Collection<Element> value);

Code void focus() #

Gives keyboard focus to the current element.
void focus();

Code Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) #

Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement);

Code Element insertAdjacentElement(String where, Element element) #

Element insertAdjacentElement(String where, Element element);

Code void insertAdjacentHTML(String where, String html) #

Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given.
void insertAdjacentHTML(String where, String html);

Code void insertAdjacentText(String where, String text) #

void insertAdjacentText(String where, String text);

Code bool matchesSelector(String selectors) #

Returns whether or not the element would be selected by the specified selector string.
bool matchesSelector(String selectors);

Code ElementEvents get on() #

ElementEvents get on();

Code Element get parent() #

Element get parent();

Code Future<ElementRect> get rect() #

Future<ElementRect> get rect();

Code void scrollByLines(int lines) #

void scrollByLines(int lines);

Code void scrollByPages(int pages) #

void scrollByPages(int pages);

Code void scrollIntoView([bool centerIfNeeded]) #

void scrollIntoView([bool centerIfNeeded]);

Code void webkitRequestFullScreen(int flags) #

Asynchronously asks the browser to make the element full-screen.
void webkitRequestFullScreen(int flags);

Code void webkitRequestFullscreen() #

void webkitRequestFullscreen();

Code void webkitRequestPointerLock() #

void webkitRequestPointerLock();

Code String $dom_getAttribute(String name) #

Retrieve the value of the named attribute from the current node.
String $dom_getAttribute(String name);

Code ClientRect $dom_getBoundingClientRect() #

ClientRect $dom_getBoundingClientRect();

Code ClientRectList $dom_getClientRects() #

ClientRectList $dom_getClientRects();

Code NodeList $dom_getElementsByClassName(String name) #

NodeList $dom_getElementsByClassName(String name);

Code NodeList $dom_getElementsByTagName(String name) #

Retrieve a set of all descendant elements, of a particular tag name, from the current element.
NodeList $dom_getElementsByTagName(String name);

Code bool $dom_hasAttribute(String name) #

Check if the element has the specified attribute, or not.
bool $dom_hasAttribute(String name);

Code Element $dom_querySelector(String selectors) #

Element $dom_querySelector(String selectors);

Code NodeList $dom_querySelectorAll(String selectors) #

NodeList $dom_querySelectorAll(String selectors);

Code void $dom_removeAttribute(String name) #

Remove the named attribute from the current node.
void $dom_removeAttribute(String name);

Code void $dom_setAttribute(String name, String value) #

Set the value of the named attribute from the current node.
void $dom_setAttribute(String name, String value);

Fields

Code String contentEditable #

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

Code final Map<String, String> dataset #

Allows access to read and write custom data attributes on the element.
final Map<String, String> dataset;

Code String dir #

Gets/sets the directionality of the element.
String dir;

Code bool draggable #

bool draggable;

Code bool hidden #

bool hidden;

Code String id #

Gets/sets the id of the element.
String id;

Code String innerHTML #

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

Code final bool isContentEditable #

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

Code String lang #

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

Code final Element nextElementSibling #

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

Code final Element offsetParent #

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

Code 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;

Code final Element previousElementSibling #

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

Code bool spellcheck #

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

Code final CSSStyleDeclaration style #

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

Code int tabIndex #

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

Code final String tagName #

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

Code String title #

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

Code bool translate #

bool translate;

Code final String webkitRegionOverflow #

final String webkitRegionOverflow;

Code String webkitdropzone #

String webkitdropzone;

Code final int $dom_childElementCount #

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

Code final HTMLCollection $dom_children #

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

Code String $dom_className #

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

Code final int $dom_clientHeight #

The inner height of an element.
final int $dom_clientHeight;

Code final int $dom_clientLeft #

The width of the left border of an element.
final int $dom_clientLeft;

Code final int $dom_clientTop #

The width of the top border of an element.
final int $dom_clientTop;

Code final int $dom_clientWidth #

The inner width of an element.
final int $dom_clientWidth;

Code 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;

Code 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;

Code final int $dom_offsetHeight #

The height of an element, relative to the layout.
final int $dom_offsetHeight;

Code final int $dom_offsetLeft #

The distance from this element's left border to its offsetParent's left border.
final int $dom_offsetLeft;

Code final int $dom_offsetTop #

The distance from this element's top border to its offsetParent's top border.
final int $dom_offsetTop;

Code final int $dom_offsetWidth #

The width of an element, relative to the layout.
final int $dom_offsetWidth;

Code final int $dom_scrollHeight #

The scroll view height of an element.
final int $dom_scrollHeight;

Code int $dom_scrollLeft #

Gets/sets the left scroll offset of an element.
int $dom_scrollLeft;

Code int $dom_scrollTop #

Gets/sets the top scroll offset of an element.
int $dom_scrollTop;

Code final int $dom_scrollWidth #

The scroll view width of an element.
final int $dom_scrollWidth;

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.