HTML DOM Element isDefaultNamespace() Method

Definition and usage

isDefaultNamespace() The method returns trueif the specified namespace is the default; otherwise returns false.

Note: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

See also:

namespaceURI property

Example

Is the defined namespace the default namespace?

let answer = element.isDefaultNamespace("http://www.w3.org/1999/xhtml");

Try it yourself

Syntax

element.isDefaultNamespace(namespaceURI)

or

node.isDefaultNamespace(namespaceURI)

Parameter

Parameter Description
namespaceURI Required. The URI of the namespace to check.

Return value

Type Description
Boolean value Returns true if the namespace is the default one, otherwise returns false.

Browser support

element.isDefaultNamespace() It is a feature of DOM Level 3 (2004).

All browsers fully support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support