Installation
npm install --save @types/dom-parser
Summary
This package contains type definitions for dom-parser (https://github.com/ershov-konst/dom-parser#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dom-parser.
declare class DomParser {
constructor();
parseFromString(html: string): DomParser.Dom;
}
declare namespace DomParser {
interface Dom extends DOMSearchable {
getElementsByClassName(className: string): Node[] | null;
getElementsByTagName(tagName: string): Node[] | null;
getElementsByName(name: string): Node[] | null;
getElementById(id: string): Node | null;
getElementsByAttribute(attr: string, value: string): Node[] | null;
}
interface Node extends DOMSearchable {
nodeType: NodeType;
nodeName: string;
childNodes: Node[];
firstChild: Node | null;
lastChild: Node | null;
parentNode: Node | null;
attributes: string[];
innerHTML: string;
outerHTML: string;
textContent: string;
getElementsByClassName(className: string): Node[] | null;
getElementsByTagName(tagName: string): Node[] | null;
getElementsByName(name: string): Node[] | null;
getElementById(id: string): Node | null;
getAttribute(name: string): string | null;
}
interface DOMSearchable {
getElementsByClassName(className: string): Node[] | null;
getElementsByTagName(tagName: string): Node[] | null;
getElementsByName(name: string): Node[] | null;
getElementById(id: string): Node | null;
}
enum NodeType {
ELEMENT_NODE = 1,
TEXT_NODE = 3,
}
}
export = DomParser;
Additional Details
- Last updated: Mon, 06 Nov 2023 22:41:05 GMT
- Dependencies: none
Credits
These definitions were written by Guy Bidkar.