nsIDOMElement

This interface represents an element in an HTML or XML document.
Inherits from: nsIDOMNode Last changed in Gecko 1.7

Method overview

DOMString getAttribute(in DOMString name);
nsIDOMAttr getAttributeNode(in DOMString name);
nsIDOMAttr getAttributeNodeNS(in DOMString namespaceURI, in DOMString localName);
DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName);
nsIDOMNodeList getElementsByTagName(in DOMString name);
nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI, in DOMString localName);
boolean hasAttribute(in DOMString name);
boolean hasAttributeNS(in DOMString namespaceURI, in DOMString localName);
void removeAttribute(in DOMString name)
nsIDOMAttr removeAttributeNode(in nsIDOMAttr oldAttr)
void removeAttributeNS(in DOMString namespaceURI, in DOMString localName)
void setAttribute(in DOMString name, in DOMString value)
nsIDOMAttr setAttributeNode(in nsIDOMAttr newAttr)
nsIDOMAttr setAttributeNodeNS(in nsIDOMAttr newAttr)
void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value)

Attributes

Attribute Type Description
tagName DOMString The element tag name. Read only.

Methods

getAttribute()

Get an attribute value.

DOMString getAttribute(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A DOMString containing the attribute value.

getAttributeNode()

Get an attribute node.

nsIDOMAttr getAttributeNode(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A nsIDOMAttr corresponding to the attribute.

getAttributeNodeNS()

Get an attribute node in a given namespace.

nsIDOMAttr getAttributeNodeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A nsIDOMAttr corresponding to the attribute.

getAttributeNS()

Get an attribute value in a given namespace.

DOMString getAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A DOMString containing the attribute value.

getElementsByTagName()

Get all descendants of a tag name.

nsIDOMNodeList getElementsByTagName(
  in DOMString name
);
Parameters
name
Tag name
Return value

A nsIDOMNodeList containg all the descendants of this tag name.

getElementsByTagNameNS()

Get all descendants of a tag name in a given namespace.

nsIDOMNodeList getElementsByTagNameNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Tag name
Return value

A nsIDOMNodeList containg all the descendants of this tag name.

hasAttribute()

Check if the element have this attribute set.

boolean hasAttribute(
  in DOMString name
);
Parameters
name
Attribute name
Return value

A boolean, true if the given attribute is set.

hasAttributeNS()

Check if the element for a given namespace have this attribute set.

boolean hasAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Attribute name
Return value

A boolean, true if the given attribute is set.

removeAttribute()

Remove an attribute.

void removeAttribute(
  in DOMString name
);
Parameters
name
Attribute name

removeAttributeNode()

Remove an attribute, giving the attribute node.

nsIDOMAttr removeAttributeNode(
  in nsIDOMAttr oldAttr
);
Parameters
oldAttr
Attribute node to remove
Return value

A nsIDOMAttr corresponding to the removed attribute node.

removeAttributeNS()

Remove an attribute.

void removeAttributeNS(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
Namespace URI
localName
Tag name

setAttribute()

Set an attribute.

void setAttribute(
  in DOMString name,
  in DOMString value
);
Parameters
name
Attribute name
value
Attribute new value

setAttributeNode()

Set an attribute, giving the attribute node.

nsIDOMAttr setAttributeNode(
  in nsIDOMAttr newAttr
);
Parameters
newAttr
Attribute node.
Return value

A nsIDOMAttr corresponding to the attribute node added.

setAttributeNodeNS()

Set an attribute, giving the attribute node.

nsIDOMAttr setAttributeNodeNS(
  in nsIDOMAttr newAttr
);
Parameters
newAttr
Attribute node.
Return value

A nsIDOMAttr corresponding to the attribute node added.

setAttributeNS()

Set an attribute.

void setAttributeNS(
  in DOMString namespaceURI,
  in DOMString qualifiedName,
  in DOMString value
);
Parameters
namespaceURI
Namespace URI
qualifiedName
Attribute name
value
Attribute new value

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh, Grubshka
 Last updated by: Sheppy,