ZVON > References > DOM2 Reference

removeNamedItemNS (method )

Owning interface and usage:  
NamedNodeMap.removeNamedItemNS(namespaceURI, localName)

Member of these other interfaces:  
none

Description:  
Removes a node specified by local name and namespace URI.

Parameters:  
DOMString namespaceURI  -  The namespace URI of the node to remove.
DOMString localName  -  The local name of the node to remove.

Returns:  
Node -  The node removed from this map if a node with such a local name and namespace URI exists.

Exceptions:  
DOMException NOT_FOUND_ERR
Raised if there is no node with the specified namespaceURI and localName in this map.
DOMException NO_MODIFICATION_ALLOWED_ERR
Raised if this map is readonly.
DOMException NOT_SUPPORTED_ERR
May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML4]).

Note:  
When this map contains the attributes attached to an element and this attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.


Example:
Text in the first DIV.
x a b x
Text in the last DIV.
Source:
   <div id="doc" xmlns:svg="http://www.w3.org/2000/svg">
     <div>
       Text in the first DIV.
     </div>
     <svg:svg id="logo" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="60">
       <svg:g style="fill:#3399cc; font-size:36pt; font-family:'dialog'; font-weight: bold">
         <svg:a xlink:type="simple" xlink:href="http://www.zvon.org">
           <svg:text x="50%" y="65%" text-anchor="middle">ZVON.org</svg:text>
         </svg:a>
       </svg:g>
     </svg:svg>
     <apply xmlns="http://www.w3.org/1998/Math/MathML">
   <int/> 
   <bvar> 
     <ci> x </ci> 
   </bvar> 
   <interval> 
     <ci> a </ci> 
     <ci> b </ci> 
   </interval> 
   <apply>
     <cos/> 
     <ci> x </ci> 
   </apply> 
     </apply> 
     <div>
       Text in the last DIV.
     </div>
   </div>
     
JavaScript:
  var elem = document.getElementsByTagName('svg:a')[0].attributes;
  var removedNode = elem.removeNamedItemNS('http://www.w3.org/1999/xlink', 'href');
  var output1 = removedNode.nodeValue;
  var output2 = elem.getNamedItemNS('http://www.w3.org/1999/xlink', 'href').value;
Output:
desired your browser
output1: http://www.zvon.org
output2: