@types/htmlparser2

  • Version 3.10.7
  • Published
  • 6.75 kB
  • 4 dependencies
  • MIT license

Install

npm i @types/htmlparser2
yarn add @types/htmlparser2
pnpm add @types/htmlparser2

Overview

TypeScript definitions for htmlparser2

Index

Classes

class Parser

class Parser {}

    constructor

    constructor(handler: DomHandler, options?: ParserOptions);

      method done

      done: () => void;
      • * alias for backwards compat

      method end

      end: { (): void; (chunk: string): void };
      • * Parses the end of the buffer and clears the stack, calls onend.

      method onattribend

      onattribend: () => void;

        method onattribname

        onattribname: (name: string) => void;

          method oncdata

          oncdata: (value: string) => void;

            method onclosetag

            onclosetag: (name: string) => void;

              method oncomment

              oncomment: (value: string) => void;

                method ondeclaration

                ondeclaration: () => void;

                  method onend

                  onend: () => void;

                    method onerror

                    onerror: (err: Error) => void;

                      method onopentagend

                      onopentagend: () => void;

                        method onopentagname

                        onopentagname: (name: string) => void;

                          method onprocessinginstruction

                          onprocessinginstruction: (value: string) => void;

                            method onselfclosingtag

                            onselfclosingtag: () => void;

                              method ontext

                              ontext: (data: any) => void;

                                method parseChunk

                                parseChunk: (chunk: string) => void;
                                • * alias for backwards compat

                                method parseComplete

                                parseComplete: (input: string) => void;
                                • * Resets the parser, parses the data & calls end.

                                  Parameter input

                                method pause

                                pause: () => void;
                                • * Pauses the parser

                                method reset

                                reset: () => void;
                                • * Resets buffer & stack, calls onreset.

                                method resume

                                resume: () => void;
                                • * Resumes the parser

                                method write

                                write: (input: string) => void;
                                • * Parses a chunk of data and calls the corresponding callbacks.

                                  Parameter input

                                class WritableStream

                                class WritableStream extends Writable {}

                                  constructor

                                  constructor(handler: DomHandler, options?: ParserOptions);

                                    Interfaces

                                    interface ParserOptions

                                    interface ParserOptions {}

                                      property decodeEntities

                                      decodeEntities?: boolean | undefined;
                                      • * If set to true, entities within the document will be decoded. Defaults to false.

                                      property lowerCaseAttributeNames

                                      lowerCaseAttributeNames?: boolean | undefined;
                                      • * If set to true, all attribute names will be lowercased. This has noticeable impact on speed, so it defaults to false.

                                      property lowerCaseTags

                                      lowerCaseTags?: boolean | undefined;
                                      • * If set to true, all tags will be lowercased. If xmlMode is disabled, this defaults to true.

                                      property recognizeCDATA

                                      recognizeCDATA?: boolean | undefined;
                                      • * If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled. NOTE: If xmlMode is set to true then CDATA sections will always be recognized as text.

                                      property recognizeSelfClosing

                                      recognizeSelfClosing?: boolean | undefined;
                                      • * If set to true, self-closing tags will trigger the onclosetag event even if xmlMode is not set to true. NOTE: If xmlMode is set to true then self-closing tags will always be recognized.

                                      property xmlMode

                                      xmlMode?: boolean | undefined;
                                      • * Indicates whether special tags ( and ) should get special treatment and if "empty" tags (eg. ) can have children. If false, the content of special tags will be text only. For feeds and other XML content (documents that don't consist of HTML), set this to true. Default: false.

                                      Type Aliases

                                      type Options

                                      type Options = ParserOptions;
                                      • Deprecated

                                      Package Files (1)

                                      Dependencies (4)

                                      Dev Dependencies (0)

                                      No dev dependencies.

                                      Peer Dependencies (0)

                                      No peer dependencies.

                                      Badge

                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/htmlparser2.

                                      • Markdown
                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/htmlparser2)
                                      • HTML
                                        <a href="https://www.jsdocs.io/package/@types/htmlparser2"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>