Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

2.1.1 [DOM Level 2 - Core] Section 1.1.8, XML Namespaces


The specification states:

 As far as the DOM is concerned, special attributes used for declaring XML 
 namespaces are still exposed and can be manipulated just like any other attribute. 
 However, nodes are permanently bound to namespace URIs as they get created.

Quirks Mode, IE7 Mode, IE8 Mode, and IE9 Mode (All Versions)

Special attributes that are used to declare namespace-like constructs that begin with "xmlns:" on the root html element are supported in HTML documents. These attributes create side effects during HTML parsing, but they do not affect the namespace URI of created elements.


The specification states:

 Note that because the DOM does no lexical checking, the empty string will be treated as a real namespace URI in DOM Level 2 methods. Applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

IE9 Mode, IE10 Mode, IE11 Mode, and EdgeHTML Mode (All Versions)

For DOM APIs that take a namespaceURI parameter, if the parameter value is an empty string, it is converted to a value of null.


The specification states:

 The new methods, such as createElementNS and createAttributeNS of the Document interface, are meant to be used by namespace aware applications. Simple applications that do not use namespaces can use the DOM Level 1 methods, such as createElement and createAttribute. Elements and attributes created in this way do not have any namespace prefix, namespace URI, or local name.

IE9 Mode, IE10 Mode, IE11 Mode, and EdgeHTML Mode (All Versions)

Elements and attributes that are created by [DOM Level 1] methods have a local name that is equivalent to the value of the nodeName attribute.

In addition, elements that are created by DOM Level 1 methods have a namespaceURI attribute with one of the following possible values:

  • If the elements are created in an HTML or XHTML document, the value is "http://www.w3.org/1999/xhtml".

  • If the elements are created in an XML or SVG document, the value is null.

© 2015 Microsoft