pseudo-dom
    Preparing search index...

    Class PseudoNodeList

    A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than the linkers that hold them.

    Hierarchy

    • LinkedTreeList
      • PseudoNodeList
    Index
    • Create the new LinkedTreeList instance, configure the list class.

      Parameters

      • OptionallinkerClass: typeof TreeLinker

        The class used to wrap given data as tree linkers.

      Returns PseudoNodeList

    classType: typeof LinkedTreeList

    The class used to create this instance, so that it can be recognized as valid without an instanceof check.

    initialized: boolean

    Whether the inner list has been initialized (it can only be initialized once).

    innerList: any

    A linker of the list (null when the list is empty); the head is found by walking back from it.

    linkerClass: typeof TreeLinker

    The class used to wrap the data given to this list as tree linkers.

    fromArray: (
        values?: any[],
        linkerClass?: typeof TreeLinker,
        classType?: any,
    ) => any

    Convert an array into a LinkedTreeList instance, return the new instance.

    Type Declaration

      • (values?: any[], linkerClass?: typeof TreeLinker, classType?: any): any
      • Parameters

        • Optionalvalues: any[]

          An array of values which will be converted to nodes in this tree-list

        • OptionallinkerClass: typeof TreeLinker

          The class to use for each node

        • OptionalclassType: any

          Provide the type of IsArrayable to use.

        Returns any

    • get first(): TreeLinker

      Retrieve the first TreeLinker in the list.

      Returns TreeLinker

    • get last(): TreeLinker

      Retrieve the last TreeLinker in the list. The end is remembered, so this does not walk the list.

      Returns TreeLinker

    • get length(): number

      Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list (call reset() after linkers were changed directly).

      Returns number

    • get list(): TreeLinker

      Retrieve the innerList used (the list itself, not a copy).

      Returns TreeLinker

    • get parent(): TreeLinker

      Get the parent of this tree list: the node these linkers are the children of (remembered even while the list is empty), or null for the linkers at the top of a tree.

      Returns TreeLinker

    • set parent(parent: TreeLinker): void

      Set the parent of this tree list: every linker in it gets the node as its parent, and the node gets this list as its children. Linkers added to the list later get this parent too.

      Parameters

      • parent: TreeLinker

        The new node to use as the parent for this group of children

      Returns void

    • get rootParent(): TreeLinker

      Return the root parent of the entire tree.

      Returns TreeLinker

    • Iterate over the nodes in this list.

      Returns Iterator<any>

    • Add a node (or data) after the given (or last) node in the list.

      Parameters

      • node: any

        The new node to add to the end of the list

      • Optionalafter: TreeLinker

        The existing last node

      Returns LinkedTreeList

    • Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.

      Parameters

      • callback: forEachCallback

        The function to call for-each tree node

      • OptionalthisArg: LinkedTreeList

        Optional, 'this' reference

      Returns LinkedTreeList

      The list which was iterated.

    • Initialize the inner list, should only run once.

      Parameters

      • initialList: TreeLinker

        Give the list of tree-linkers to start in this linked-tree-list.

      Returns LinkedTreeList

    • Insert a new node (or data) after a node. The new node gets the parent of this list.

      Parameters

      • node: TreeLinker

        The existing node as reference, or null to insert at the start of the list

      • newNode: any

        The new node to go after the existing node

      Returns LinkedTreeList

    • Insert a new node (or data) before a node. The new node gets the parent of this list.

      Parameters

      • node: TreeLinker

        The existing node as reference, or null to insert at the end of the list

      • newNode: any

        The new node to go before the existing node

      Returns LinkedTreeList

    • Retrieve a TreeLinker item from this list by numeric index, otherwise return null.

      Parameters

      • index: number

        The integer number for retrieving a node by position.

      Returns TreeLinker

    • Add a node (or data) before the given (or first) node in the list.

      Parameters

      • node: any

        The new node to add to the start of the list

      • Optionalbefore: TreeLinker

        The existing first node

      Returns LinkedTreeList

    • Remove a linker from this linked list. The removed node no longer has a parent.

      Parameters

      • node: TreeLinker

        The node we wish to remove (and it will be returned after removal)

      Returns TreeLinker

      The removed node, or null when there was nothing to remove

    • Refresh all references (the head, the end and the length) by walking the list once, and return the head. The list's own methods keep these up to date, so this is only needed after linkers were changed directly.

      Returns TreeLinker

    • Set the children on a parent item.

      Parameters

      • item: TreeLinker

        The TreeLinker node (one of the linkers of this list) that will be the parent of the children

      • Optionalchildren: LinkedTreeList

        The LinkedTreeList which has the child nodes to use, or null to remove the children of the item

      Returns void

      When the item is not one of the linkers of this list