Example 1 — Read ariaSort
Log the sort token from a column header.
const el = document.getElementById("role-heading");
console.log(el.ariaSort); // "none"
// HTML: <th id="role-heading" aria-sort="none">ARIA Role</th> How It Works
- Find the header.
getElementByIdreturns the column header cell. - Read the reflection.
ariaSortreturns thearia-sortstring. - Interpret
"none". No defined sort is applied to this column yet. - Missing attribute. If unset, many browsers return
null(meaning is still none).

