NamedNodeMap: thuộc tính length

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.

Thuộc tính chỉ đọc length của giao diện NamedNodeMap là số lượng đối tượng được lưu trữ trong map.

Giá trị

Một số chứa số lượng đối tượng trong map.

Ví dụ

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`;

Thông số kỹ thuật

Thông số kỹ thuật
DOM
# dom-namednodemap-length

Tương thích trình duyệt