HTML DOM Element isDefaultNamespace()

Example

Is the defined namespace the default namespace?

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

Description

The isDefaultNamespace() method returns true if the elements's namespace is default.

Note

The default namespace URI is the same for HTML and XHTML documents.

All HTML elements inherit the namespace URI of their parents:

http://www.w3.org/1999/xhtml

See Also:

The namespaceURI Property


Syntax

element.isDefaultNamespace(namespaceURI)
or
node.isDefaultNamespace(namespaceURI)

Parameters

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

Return Value

Type Description
Booleantrue if the namespace is default, otherwise false.

Browser Support

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

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.