This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

isDefaultNamespace

Summary

Indicates whether or not a namespace is the default namespace for a document.

Method of dom/Nodedom/Node

Syntax

var isDefault = node.isDefaultNamespace(/* see parameter list */);

Parameters

namespace

Data-type
String

The namespace to be compared to the default namespace.

Return Value

Returns an object of type BooleanBoolean

Whether the namespace specified in the namespace parameter is the default namespace for the document.

Examples

The following example compares the default Namespace of the body element to the SVG namespace and then to the xHTML namespace. false then true is displayed.

<!DOCTYPE html>
<html>

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>isDefaultNamespace example</title>
</head>

<body>


   <script type="text/javascript">//<![CDATA[
    var nsSVG='http://www.w3.org/2000/svg';
    alert(document.body.isDefaultNamespace(nsSVG));
    var nsxHTML='http://www.w3.org/1999/xhtml';
    alert(document.body.isDefaultNamespace(nsxHTML));
   //]]></script>
</body>

</html>

Related specifications

DOM Level 3 Core
Recommendation

Attributions