Is the defined namespace the default namespace?
let answer = element.isDefaultNamespace("http://www.w3.org/1999/xhtml");
Try it Yourself »
The isDefaultNamespace()
method returns true
if the elements's namespace is default.
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
element.isDefaultNamespace(
namespaceURI)
node.isDefaultNamespace(
namespaceURI)
Parameter | Description |
namespaceURI | Required. The URI of the namespace to check. |
Type | Description |
Boolean | true if the namespace is default, otherwise false . |
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 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!