CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
index.d.ts76 linesDownload Raw Back to lib
1import { ChildNode, Element, DataNode, Document, ParentNode } from "./node.js";2export * from "./node.js";3export interface DomHandlerOptions {4    /**5     * Add a `startIndex` property to nodes.6     * When the parser is used in a non-streaming fashion, `startIndex` is an integer7     * indicating the position of the start of the node in the document.8     *9     * @default false10     */11    withStartIndices?: boolean;12    /**13     * Add an `endIndex` property to nodes.14     * When the parser is used in a non-streaming fashion, `endIndex` is an integer15     * indicating the position of the end of the node in the document.16     *17     * @default false18     */19    withEndIndices?: boolean;20    /**21     * Treat the markup as XML.22     *23     * @default false24     */25    xmlMode?: boolean;26}27interface ParserInterface {28    startIndex: number | null;29    endIndex: number | null;30}31declare type Callback = (error: Error | null, dom: ChildNode[]) => void;32declare type ElementCallback = (element: Element) => void;33export declare class DomHandler {34    /** The elements of the DOM */35    dom: ChildNode[];36    /** The root element for the DOM */37    root: Document;38    /** Called once parsing has completed. */39    private readonly callback;40    /** Settings for the handler. */41    private readonly options;42    /** Callback whenever a tag is closed. */43    private readonly elementCB;44    /** Indicated whether parsing has been completed. */45    private done;46    /** Stack of open tags. */47    protected tagStack: ParentNode[];48    /** A data node that is still being written to. */49    protected lastNode: DataNode | null;50    /** Reference to the parser instance. Used for location information. */51    private parser;52    /**53     * @param callback Called once parsing has completed.54     * @param options Settings for the handler.55     * @param elementCB Callback whenever a tag is closed.56     */57    constructor(callback?: Callback | null, options?: DomHandlerOptions | null, elementCB?: ElementCallback);58    onparserinit(parser: ParserInterface): void;59    onreset(): void;60    onend(): void;61    onerror(error: Error): void;62    onclosetag(): void;63    onopentag(name: string, attribs: {64        [key: string]: string;65    }): void;66    ontext(data: string): void;67    oncomment(data: string): void;68    oncommentend(): void;69    oncdatastart(): void;70    oncdataend(): void;71    onprocessinginstruction(name: string, data: string): void;72    protected handleCallback(error: Error | null): void;73    protected addNode(node: ChildNode): void;74}75export default DomHandler;76//# sourceMappingURL=index.d.ts.map
basant307/AI_Governance_Project · CoolFace