Element (W3C DOM Core object)
| Version | Depr. | Parent |
|---|---|---|
| DOM1 | No | Node |
| IE5.5+ | FF1.5+ | SA1.3+ | OP9+ |
|---|---|---|---|
| Buggy | Buggy | Buggy | Buggy |
Example
<p> <q>Don't be too proud of this technological terror you've constructed. The ability to destroy a planet is <strong>insignificant</strong> next to the power of The Force.</q> </p>
In the example above, the
<p>, <q> and
<strong> are all Element
nodes.
Description
The
Element interface inherits from Node, and represents a single element in an HTML or XML
document.
An Element node may have other
Element, Text, Comment, ProcessingInstruction, CDATASection or EntityReference nodes as
children.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.5 | 2.0 | 3.0 | 1.3 | 2.0 | 3.0 | 9.0 | 9.5 |
| Buggy | Buggy | Buggy | Buggy | Buggy | Buggy | Buggy | Buggy | Buggy | Buggy | Buggy |
Internet Explorer doesn't implement the following:
getAttributeNSgetAttributeNodeNSgetElementsByTagNameNShasAttributehasAttributeNSremoveAttributeNSsetAttributeNSsetAttributeNodeNS
Additionally, Internet Explorer 5.5 in HTML doesn't implement the following (but does in XML):
Internet Explorer 5.5 has only a
partial implementation of getElementsByTagName.
Internet
Explorer and Opera have buggy
implementations of setAttribute.
Internet Explorer 6 and 7,
Safari 1.3 and 2 and Opera
9.0 have buggy implementations of setAttributeNode.
Firefox, Safari 1.3 and
2 and Opera have buggy
implementations of getAttributeNS, getAttributeNodeNS, hasAttributeNS, removeAttributeNS, setAttributeNS and setAttributeNodeNS.
Firefox 1.5
and 2, Safari and
Opera have buggy implementations of getElementsByTagName.
Firefox and
Safari have buggy implementations of hasAttribute.
Safari 1.3 and
2 have only a partial implementation of getElementsByTagNameNS.
All
browsers have buggy implementations of getAttribute.
All browsers
except Opera 9.0 have buggy implementations of removeAttribute and removeAttributeNode.
All
browsers except Opera 9.5 have buggy implementations of
getAttributeNode.
In this Section
- getAttribute
Get the value of an attribute with the specified name. - getAttributeNode
Get an attribute node with the specified name. - getAttributeNodeNS
Get the value of an attribute with the specified name and namespace URI. - getAttributeNS
Get the value of an attribute with the specified name and namespace URI. - getElementsByTagName
Retrieves an ordered list of all elements with a given tag name, that are descendants of this document or element, in the linear order in which they appear in the DOM tree. - getElementsByTagNameNS
Retrieves an ordered list of all elements with a given localName and namespaceURI, that are descendants of this document or element, in the linear order in which they appear in the DOM tree. - hasAttribute
Whether this element has an attribute with the specified name, or has a specific default value for that attribute in this document type. - hasAttributeNS
Whether this element has an attribute with the specified local name and namespace URI, or has a specific default value for that attribute in this document type. - removeAttribute
Remove an attribute with the specified name. - removeAttributeNode
Remove a specified attribute node. - removeAttributeNS
Remove an attribute with the specified name and namespace URI. - setAttribute
Set a new attribute on this element, with the specified name and value. - setAttributeNode
Add an attribute node to this element. - setAttributeNodeNS
Add a namespaced attribute node to this element. - setAttributeNS
Set a new attribute on this element, with the specified local name, namespace URI and value. - tagName
The qualified name of an element (including any namespace prefix).
User-contributed notes
There are no comments yet.