Node.isDefaultNamespace

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

概述

isDefaultNamespace 接受一个命名空间 URI 作为参数,如果该命名空间是当前节点的默认命名空间,则返回true,否则返回false.

语法

result = node.isDefaultNamespace(namespaceURI)
  • resulttruefalse.
  • namespaceURI 为一个命名空间 URI.

例子

var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var el = document.getElementsByTagNameNS(XULNS, 'textbox')[0];
alert(el.isDefaultNamespace(XULNS)); // true

规范