Name
Element.setAttributeNodeNS( ): add a namespace Attr node to an Element â DOM Level 2 Core:
Synopsis
Attr setAttributeNodeNS(AttrnewAttr
)
throws DOMException;
Arguments
-
newAttr
The Attr node that represents the attribute to be added or whose value is to be modified.
Returns
The Attr node that was replaced by
newAttr
, or null
if no attribute was
replaced.
Throws
This method throws exceptions for the same reasons as
setAttributeNode( )
. It may
also throw a DOMException with a code
of NOT_SUPPORTED_ERR
to signal that the
method is not implemented because the current implementation does
not support XML documents and namespaces.
Description
This method works just like setAttributeNode( )
, except that it is
designed for use with Attr nodes that represent attributes specified
by namespace and name.
This method is useful only with XML documents that use
namespaces. It may be unimplemented (i.e., throw a NOT_SUPPORTED_ERR
) on browsers that do not
support XML documents.
See Also
Attr
, Document.createAttributeNS( )
, Element.setAttributeNS( )
, Element.setAttributeNode( )
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.