Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/html_parser/src/mod.ts>DomHandler

Port of fb55/htmlparser2 for Deno
Latest
class DomHandler
Re-export
import { DomHandler } from "https://deno.land/x/html_parser@v0.1.3/src/mod.ts";

Constructors

new
DomHandler(
callback?: Callback | null,
options?: DomHandlerOptions | null,
elementCB?: ElementCallback,
)

Properties

private
readonly
callback: Callback | null

Called once parsing has completed.

private
done: boolean

Indicated whether parsing has been completed.

private
readonly
elementCB: ElementCallback | null

Callback whenever a tag is closed.

private
readonly
options: DomHandlerOptions

Settings for the handler.

private
parser: ParserInterface | null

Reference to the parser instance. Used for location information.

protected
lastNode: DataNode | null

A data node that is still being written to.

protected
tagStack: NodeWithChildren[]

Stack of open tags.

dom: Node[]

The elements of the DOM

root: Document

The root element for the DOM

Methods

protected
addNode(node: Node): void
protected
handleCallback(error: Error | null): void
oncdataend(): void
oncdatastart(): void
onclosetag(): void
oncomment(data: string): void
oncommentend(): void
onend(): void
onerror(error: Error): void
onopentag(name: string, attribs: { [key: string]: string; }): void
onparserinit(parser: ParserInterface): void
onprocessinginstruction(name: string, data: string): void
onreset(): void
ontext(data: string): void