HTML DOM Element namespaceURI attribute
- Previous Page matches()
- Next Page nextSibling
- Go to the Previous Level HTML DOM Elements Object
Definition and usage
namespaceURI
The attribute returns the URI of the element's namespace.
namespaceURI
The attribute is read-only.
namespaceURI
The attribute has no practical use in HTML.
See also:
Instance
Example 1
Get the namespace URI of an element in an HTML document:
let uri = element.namespaceURI;
Example 2
Get the namespace URI of an element in an XHTML document:
let uri = element.namespaceURI;
Comment
The default namespace URI for HTML and XHTML documents is the same.
All HTML elements inherit their parent's namespace URI:
http://www.w3.org/1999/xhtml
Syntax
element.namespaceURI
Return value
Type | Description |
---|---|
String | The URI of the element's namespace. |
null | if the element is not in a namespace. |
Browser support
element.namespaceURI
It is a feature of DOM Level 2 (2001).
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page matches()
- Next Page nextSibling
- Go to the Previous Level HTML DOM Elements Object