Skip to content
Marcos Cáceres edited this page Nov 17, 2017 · 12 revisions

data-sort attribute

By using data-sort="ascending" or "descending", ReSpec can shallow sort lists of type ol, ul, and dl elements. Shallow sort meaning that only the first level of the list is sorted, and any nested lists are left alone. This is nice for Dependency sections, IDL member definitions, etc.

You can also just write data-sort and exclude the attribute value, and it will default to "ascending" (i.e., from A-to-Z).

Examples of usage

Regular list

The following sorts to "Z, W, A".

<ul data-sort="descending">
  <li>W</li>
  <li>Z</li>
  <li>A</li>
</ul>

Definition list

Sorting a definition list ("ascending" by default, so A-to-0Z locale dependent). The corresponding dds for any dt are also moved, but not sorted.

<dl data-sort>
  <dt>Bananas</dt>
  <dd>Are the best!</dd>
  <dt>Zebra</dt>
  <dd>Are quite stripy.</dd>
  <!--
    The following three elements are first after sorting
  -->
  <dt>Apple</dt>
  <dd>Are delicious 🍎.</dd>
  <dd>They really really are!🍏.</dd>
</dl>

Guides

Configuration options

W3C Configuration options

Linter rules

Internal properties

Handled by ReSpec for you.

Special <section> IDs

HTML elements

Custom Elements

WebIDL

HTML attributes

CSS Classes

Special properties

Clone this wiki locally