DescendantIndexManager

Type: Class

How to get descendantIndexManager?

JavaScript

import descendantIndexManager from 'fontoxml-dom-descendant-index/src/descendantIndexManager.js'

Provides a way to retrieve a list of all descendants of a node matching a given selector.

Methods

addDescendantsChangedCallback

Type: Function

Add a callback for changes of descendants of the container matching the itemSelector.

Use DescendantIndexManager#getIndexedDescendants to obtain the indexed nodes when the callback is invoked.

This method is optimized for descendant queries. Accessing nodes outside the subtree specified by containerNode is not supported and may yield unexpected results. For more general XPath expressions, consider using IndexManager#observeQueryResults instead.

Arguments

Returns

getIndexedDescendants

Type: Function

Returns an array of descendants of the given node matching the selector.

This list of nodes is sorted by the order in the DOM. It is also not recursive, meaning that descendants of nodes matching the selector will not be indexed. If you need to index these nodes, use getIndexedDescendants recursively.

Calling this will start monitoring the results for changes. Use DescendantIndexManager#addDescendantsChangedCallback to be notified when the results change.

This method is optimized for descendant queries. Accessing nodes outside the subtree specified by containerNode is not supported and may yield unexpected results. For more general XPath expressions, consider using IndexManager#observeQueryResults instead.

Arguments

Returns