data sort - speced/respec GitHub Wiki
Applies to: <ol>, <ul>, <dl>
Sorts the top-level items of a list alphabetically. Useful for dependency sections, IDL member definitions, glossaries, and any list that should stay alphabetically ordered.
<ul data-sort>
<li>Banana</li>
<li>Apple</li>
<li>Cherry</li>
</ul><dl data-sort="descending">
<dt>Banana</dt><dd>A yellow fruit.</dd>
<dt>Apple</dt><dd>A red or green fruit.</dd>
<dt>Cherry</dt><dd>A small red fruit.</dd>
</dl>| Value | Sorts |
|---|---|
"ascending" |
A → Z (default when attribute has no value) |
"descending" |
Z → A |
- Sorting is shallow — only the top-level items are sorted; nested lists are untouched
- For
<dl>, the<dt>is used as the sort key; associated<dd>elements move with their<dt> - Sorting is locale-aware (uses JavaScript's
Intl.Collator)