NamedNodeMap: length-Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die schreibgeschützte length-Eigenschaft des NamedNodeMap-Interfaces ist die Anzahl der Objekte, die in der Map gespeichert sind.

Wert

Eine Zahl, die die Anzahl der Objekte in der Map enthält

Beispiel

html
<pre class="foo" id="bar" contenteditable></pre>
js
const pre = document.querySelector("pre");
const attrMap = pre.attributes;
pre.textContent = `The 'test' attribute contains ${attrMap.length} attributes.\n`;

Spezifikationen

Specification
DOM
# dom-namednodemap-length

Browser-Kompatibilität