ElementVisitor

A utility class for visiting elements in the DOM tree.

It is recommended to use the static getVisitor method to obtain instances of this class because they are cached and reused based on the element and selector.

Configs

2
element: HTMLElement

The element to visit.

selector: String | function

The selector to use when visiting the element or a function which may accept of reject candidate nodes by returning

  • NodeFilter.FILTER_ACCEPT
  • NodeFilter.FILTER_REJECT
  • NodeFilter.FILTER_SKIP
ParameterTypeDescription
nodeNode

The node to accept or reject.

Returns: Number -

NodeFilter.FILTER_ACCEPT, NodeFilter.FILTER_REJECT, or NodeFilter.FILTER_SKIP.

Properties

6

Class hierarchy

isElementVisitor: Boolean= truereadonly
Identifies an object as an instance of ElementVisitor class, or subclass thereof.
isElementVisitor: Boolean= truereadonlystatic
Identifies an object as an instance of ElementVisitor class, or subclass thereof.

Lifecycle

configBase

Functions

19

Other

Returns the first element in the tree that matches the selector.

Returns: HTMLElement

Returns an ElementVisitor instance for the given element and selector.

This is the recommended way to get an ElementVisitor instance as it will reuse instances.

ParameterTypeDescription
elementHTMLElement

The element in which to visit selected descendants.

selectorString

The selector to use when visiting descendant nodes within the element.

Returns: ElementVisitor -

An ElementVisitor instance which visits the element's descendants based on the selector.

Returns the last element in the tree that matches the selector.

Returns: HTMLElement

Returns the next element in the tree that matches the selector.

Returns: HTMLElement

Returns the previous element in the tree that matches the selector.

Returns: HTMLElement

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase