TinySort is a small script that sorts HTML elements. It sorts by text- or attribute value, or by that of one of it's children.
- Version:
- 2.3.6
- Copyright:
- Ron Valstar
- Ron Valstar
- License:
- MIT
- Source:
Namespaces
- charorder
- TinySort CharOrder
Methods
-
<private, static> addCriterium(options)
-
Adds a criterium
Parameters
Type Argument Description optionsObject <optional>
- Source:
-
<private, static> addGhost(elmObj) → {elementObject}
-
Adds a temporary element before an element before reordering.
Parameters
Type Description elmObjelementObject Returns
Description elementObject- Source:
-
<private, static> applyToDOM()
-
Applies the sorted list to the DOM
- Source:
-
<private, static> chunkify(t) → {Array}
-
Split a string into an array by type: numeral or string
Parameters
Type Description tstring Returns
Description Array- Source:
-
<private, static> extend(obj, fns, overwrite) → {Object}
-
Extend an object
Parameters
Type Argument Default Description objObject Subject.
fnsObject Property object.
overwriteboolean <optional>
false Overwrite properties.
Returns
Description ObjectSubject.
- Source:
-
<private, static> getSortBy(elementObject, criterium) → {String}
-
Get the string/number to be sorted by checking the elementObject with the criterium.
Parameters
Type Description elementObjectelementObject criteriumcriterium Returns
Description String- Source:
- To Do:
-
- memoize
-
<private, static> initSortList()
-
Creates an elementObject and adds to lists. Also checks if has one or more parents.
- Source:
-
<private, static> isString(o) → {boolean}
-
Test if an object is a string
Parameters
Type Description oReturns
Description boolean- Source:
-
<private, static> loop(array, func)
-
Traverse an array, or array-like object
Parameters
Type Description arrayArray The object or array
funcfunction Callback function with the parameters value and key.
- Source:
-
<private, static> replaceGhost(elmObjGhost, elm)
-
Inserts an element before a ghost element and removes the ghost.
Parameters
Type Description elmObjGhostelementObject elmHTMLElement - Source:
-
<private, static> sortedIntoFragment() → {DocumentFragment}
-
Adds all sorted elements to the document fragment and returns it.
Returns
Description DocumentFragment- Source:
-
<private, static> sortFunction(a, b) → {number}
-
Sort all the things
Parameters
Type Description aelementObject belementObject Returns
Description number- Source:
-
<static> tinysort(nodeList, options) → {Array.<HTMLElement>}
-
TinySort is a small and simple script that will sort any nodeElement by it's text- or attribute value, or by that of one of it's children.
Parameters
Type Argument Description nodeListNodeList | Array.<HTMLElement> | String The nodelist or array of elements to be sorted. If a string is passed it should be a valid CSS selector.
optionsoptions <optional>
A list of options.
Returns
Description Array.<HTMLElement>- Source: