Example 1 — Read ariaSetSize
Log the total set size from a tab.
const el = document.getElementById("tab-id");
console.log(el.ariaSetSize); // "3"
// HTML: <button role="tab" id="tab-id" aria-setsize="3">…</button> How It Works
- Find the tab.
getElementByIdreturns the tab node. - Read the reflection.
ariaSetSizereturns thearia-setsizestring. - Interpret
"3". The complete set has three items (even if fewer are in the DOM). - Missing attribute. If unset, many browsers return
null.

