Skip to main content

Function: selectBySelector()

selectBySelector(root, selector): SelectorNode[]

Defined in: packages/core/src/domain/services/selector-matching.ts:163

Selects nodes matching the given selector, optionally constrained by a parent selector. Supports selector.index filtering for targeting specific items.

This is the entry point used by the rule evaluator, which needs parent-scoped selection and index support beyond what findNodes provides.

Parameters

root

SelectorNode

The AST root node to search

selector

Selector

The selector criteria to match

Returns

SelectorNode[]

All matching nodes, filtered by selector.index when present