HierarchyProvider<TNode> Interface
Package: @esfx/iter-hierarchy
Describes an object that defines the relationships between parents and children of an element.
Declaration
export interface HierarchyProvider<TNode>
Methods
children(element)
Gets the children elements for the supplied element.
Declaration
children(element: TNode): Iterable<TNode> | undefined;
Parameters
- element
- TNode
Returns
firstChild(element)
(Optional) Gets the first child of an element.
NOTE: A HierarchyProvider should implement this to improve the performance of the following
query operator on hierarchies.
Declaration
firstChild?(element: TNode): TNode | undefined;
Parameters
- element
- TNode
Returns
lastChild(element)
(Optional) Gets the last child of an element.
NOTE: A HierarchyProvider should implement this to improve the performance of the preceding
query operator on hierarchies.
Declaration
lastChild?(element: TNode): TNode | undefined;
Parameters
- element
- TNode
Returns
nextSibling(element)
(Optional) Gets the next sibling of an element.
NOTE: A HierarchyProvider should implement this to improve the performance of the following
and followingSiblings
query operators on hierarchies.
Declaration
nextSibling?(element: TNode): TNode;
Parameters
- element
- TNode
Returns
owns(element)
(Optional) Indicates whether the supplied element is contained within a hierarchy.
Declaration
owns?(element: TNode): boolean;
Parameters
- element
- TNode
Returns
parent(element)
Gets the parent element for the supplied element.
Declaration
parent(element: TNode): TNode | undefined;
Parameters
- element
- TNode
Returns
previousSibling(element)
(Optional) Gets the previous sibling of an element.
NOTE: A HierarchyProvider should implement this to improve the performance of the preceding
and precedingSiblings
query operators on hierarchies.
Declaration
previousSibling?(element: TNode): TNode;
Parameters
- element
- TNode
Returns
provider(element)
(Optional) If this provider is composed from multiple providers, finds the underlying provider for an element.
Declaration
provider?(element: TNode): HierarchyProvider<TNode> | undefined;
Parameters
- element
- TNode
Returns
providers()
(Optional) If this provider is composed from multiple providers, returns an iterable of each underlying provider.
Declaration
providers?(): IterableIterator<HierarchyProvider<TNode>>;
Returns
root(element)
(Optional) Gets the root node for an element.
NOTE: A HierarchyProvider should implement this to improve the performance of the root
query operator on hierarchies.
Declaration
root?(element: TNode): TNode;
Parameters
- element
- TNode
Returns