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:
- DOM Core Specification—describes the core interfaces shared by most DOM objects in HTML and XML documents
- DOM HTML Specification—describes interfaces for objects in HTML and XHTML documents that build on the core specification
- DOM Events Specification—describes events shared by most DOM objects, building on the DOM Core and Views specifications
- Element Traversal Specification—describes the new attributes that allow traversal of elements in the DOM tree New in Firefox 3.5
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
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
Static Fields
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 set classes(Collection<String> value) #
void set classes(Collection<String> value);
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 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) #
void insertAdjacentHTML(String where, String html);
Code void insertAdjacentText(String where, String text) #
void insertAdjacentText(String where, String text);
Code bool matchesSelector(String selectors) #
bool matchesSelector(String selectors);
Code ElementEvents get on() #
ElementEvents get on();
Code Future<ElementRect> get rect() #
Future<ElementRect> get rect();
Code void webkitRequestFullScreen(int flags) #
void webkitRequestFullScreen(int flags);
Code void webkitRequestFullscreen() #
void webkitRequestFullscreen();
Code void webkitRequestPointerLock() #
void webkitRequestPointerLock();
Code String $dom_getAttribute(String name) #
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) #
NodeList $dom_getElementsByTagName(String name);
Code bool $dom_hasAttribute(String name) #
bool $dom_hasAttribute(String name);
Code NodeList $dom_querySelectorAll(String selectors) #
NodeList $dom_querySelectorAll(String selectors);
Code void $dom_removeAttribute(String name) #
void $dom_removeAttribute(String name);
Code void $dom_setAttribute(String name, String value) #
void $dom_setAttribute(String name, String value);
Fields
Code String contentEditable #
String contentEditable;
Code final Map<String, String> dataset #
final Map<String, String> dataset;
Code final bool isContentEditable #
final bool isContentEditable;
Code String lang #
String lang;
Code final Element nextElementSibling #
null
if there's no sibling node.
final Element nextElementSibling;
Code final Element offsetParent #
final Element offsetParent;
Code final String outerHTML #
final String outerHTML;
Code final Element previousElementSibling #
null
if there is no sibling element.
final Element previousElementSibling;
Code bool spellcheck #
bool spellcheck;
Code final CSSStyleDeclaration style #
final CSSStyleDeclaration style;
Code String title #
String title;
Code final int $dom_childElementCount #
final int $dom_childElementCount;
Code final HTMLCollection $dom_children #
nsIDOMNodeList
of the current child elements.
final HTMLCollection $dom_children;
Code final int $dom_clientLeft #
final int $dom_clientLeft;
Code final int $dom_clientTop #
final int $dom_clientTop;
Code final Element $dom_firstElementChild #
null
if the element has no child elements.
final Element $dom_firstElementChild;
Code final Element $dom_lastElementChild #
null
if the element has no child elements.
final Element $dom_lastElementChild;
Code final int $dom_offsetHeight #
final int $dom_offsetHeight;
Code final int $dom_offsetLeft #
offsetParent
's left border.
final int $dom_offsetLeft;
Code final int $dom_offsetTop #
offsetParent
's top border.
final int $dom_offsetTop;
Code final int $dom_offsetWidth #
final int $dom_offsetWidth;
Code final int $dom_scrollHeight #
final int $dom_scrollHeight;
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.