Sorts the direct child elements of a container by their data-sort attribute.
Elements with:
data-sort < 0→ Excluded from sorting, moved last, and gettabindex="-1".data-sort ≥ 0→ Sorted in ascending order.- no
data-sort→ Appended before or after the sorted items depending onsortOrder.
- Version
- 1.0.0
- License
- MIT
- Source
- sortElements.js, line 12
Methods
static sortElements(container, sortOrderopt)
Sorts the direct child elements of a container by their data-sort attribute.
| Name | Type | Attributes | Description |
|---|---|---|---|
container |
HTMLElement |
The container whose children should be sorted. |
|
sortOrder |
'sorted-last' | '' | optional |
Determines whether sorted items come after ( |
- Source
- sortElements.js, line 20