Function insertSorted

Inserts element into parent sorted according to its HTML attribute data-sort.

Assumes:

  • Every child of parent and element, has a data-sort attribute. This is the basis for sorting.
  • parent starts off empty or pre-sorted.
  • Order of parent's children is not changed (ie it always remains sorted)
  • Parameters

    • parent: HTMLElement

      Parent to insert into

    • element: HTMLElement

      Element to insert

    Returns void