Skip to main content

DomVisitorCallbacks

reexport
interface DomVisitorCallbacks {
  onDocument?: (document: Document) => void;
  onElement?: (element: Element) => void;
  onText?: (text: Text) => void;
}

A record of callback to visit the DOM.

Methods#

onDocument#

optional
onDocument?: (document: Document) => void;

A callback invoked when encountering a ​Document.

Parameters#

document

The document to visit.

onElement#

optional
onElement?: (element: Element) => void;

A callback invoked when encountering an ​Element.

Parameters#

element

The element to visit.

onText#

optional
onText?: (text: Text) => void;

A callback invoked when encountering a ​Text node.

Parameters#

text

The text to visit.