blockly > FocusableTreeTraverser
FocusableTreeTraverser class
A helper utility for IFocusableTree implementations to aid with common tree traversals.
Signature:
export declare class FocusableTreeTraverser
Methods
Method | Modifiers | Description |
---|---|---|
findFocusableNodeFor(element, tree) | static |
Returns the IFocusableNode corresponding to the specified HTML or SVG element iff it's the root element or a descendent of the root element of the specified IFocusableTree. If the element exists within the specified tree's DOM structure but does not directly correspond to a node, the nearest parent node (or the tree's root) will be returned to represent the provided element. If the tree contains another nested IFocusableTree, the nested tree may be traversed but its nodes will never be returned here per the contract of IFocusableTree.lookUpFocusableNode. The provided element must have a non-null ID that conforms to the contract mentioned in IFocusableNode. |
findFocusedNode(tree) | static |
Returns the current IFocusableNode that is styled (and thus represented) as having either passive or active focus, only considering HTML and SVG elements. This can match against the tree's root. Note that this will never return a node from a nested sub-tree as that tree should specifically be used to retrieve its focused node. |