You are on page 1of 10

07/10/2020 NamedNodeMap - Web APIs | MDN

Sign in

English ▼

NamedNodeMap

The NamedNodeMap interface represents a collection of Attr objects. Objects inside a


NamedNodeMap are not in any particular order, unlike NodeList , although they may be
accessed by an index as in an array.

A NamedNodeMap object is live and will thus be auto-updated if changes are made to its
contents internally or elsewhere.

Although called NamedNodeMap , this interface doesn't deal with Node objects but with
Attr objects, which were originally a specialized class of Node , and still are in some
implementations.

Properties
This interface doesn't inherit any property.

NamedNodeMap.length Read only

Returns the amount of objects in the map.

Methods
This interface doesn't inherit any method.

NamedNodeMap.getNamedItem()
Returns a Attr , corresponding to the given name.

NamedNodeMap.setNamedItem()

https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 1/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Replaces, or adds, the Attr identified in the map by the given name.

NamedNodeMap.removeNamedItem()
Removes the Attr identified by the given map.

NamedNodeMap.item()
Returns the Attr at the given index, or null if the index is higher or equal to the number
of nodes.

NamedNodeMap.getNamedItemNS()
Returns a Attr identified by a namespace and related local name.

NamedNodeMap.setNamedItemNS()
Replaces, or adds, the Attr identified in the map by the given namespace and related local
name.

NamedNodeMap.removeNamedItemNS()
Removes the Attr identified by the given namespace and related local name.

Specifications
Specification Status Comment

DOM LS
The definition of 'NamedNodeMap' in Living Deals with Attr instead of Node
that specification. Standard

Document Object Model


(DOM) Level 3 Core
No change from Document Object Model
Specification Obsolete
(DOM) Level 2 Core Specification
The definition of 'NamedNodeMap' in
that specification.

Document Object Model


(DOM) Level 2 Core Added getNamedItemNS() ,
Specification Obsolete setNamedItemNS() and
The definition of 'NamedNodeMap' in removeNamedItemNS()
that specification.

Document Object Model Obsolete Initial definition


https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 2/10
07/10/2020 NamedNodeMap - Web APIs | MDN

(DOM) Level 1 Specification


The definition of 'NamedNodeMap' in
that specification.

Browser compatibility
Update compatibility data on GitHub

NamedNodeMap

Chrome Yes

Edge 12

Firefox 34

IE Yes

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

getNamedItem

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes


https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 3/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

getNamedItemNS

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

item

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 4/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

length

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

removeNamedItem

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 5/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Samsung Internet Android Yes

removeNamedItemNS

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

setNamedItem

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

setNamedItemNS
https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 6/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Chrome Yes

Edge 12

Firefox 34

IE ?

Opera Yes

Safari Yes

WebView Android Yes

Chrome Android Yes

Firefox Android 34

Opera Android Yes

Safari iOS Yes

Samsung Internet Android Yes

What are we missing?

Full support

Compatibility unknown

Uses a non-standard name.

See also
Element.attributes

Last modified: Mar 23, 2019, by MDN contributors

Related Topics
Document Object Model
https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 7/10
07/10/2020 NamedNodeMap - Web APIs | MDN

NamedNodeMap

▼ Methods

getNamedItem()

▼ Related pages for DOM

AbortController

AbortSignal

AbstractRange

Attr

ByteString

CDATASection

CSSPrimitiveValue

CSSValue

CSSValueList

CharacterData

ChildNode

Comment

CustomEvent

DOMConfiguration

DOMError

DOMErrorHandler

DOMException

DOMImplementation

DOMImplementationList

DOMImplementationRegistry

DOMImplementationSource

DOMLocator

DOMObject

DOMParser

DOMPoint

DOMPointInit

DOMPointReadOnly

DOMRect
https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 8/10
07/10/2020 NamedNodeMap - Web APIs | MDN
DOMRect

DOMString

DOMTimeStamp

DOMTokenList

DOMUserData

Document

DocumentFragment

DocumentType

Element

ElementTraversal

Entity

EntityReference

Event

EventTarget

HTMLCollection

MutationObserver

Node

NodeFilter

NodeIterator

NodeList

NonDocumentTypeChildNode

ProcessingInstruction

PromiseResolver

Range

StaticRange

Text

TextDecoder

TextEncoder

TimeRanges

TreeWalker

TypeInfo

USVString

UserDataHandler

XMLDocument

https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 9/10
07/10/2020 NamedNodeMap - Web APIs | MDN

Learn the best of web development


Get the latest and greatest from MDN delivered straight to your inbox.

you@example.com

Sign up now

https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap 10/10

You might also like