UNPKG

@awesome-fe/translate

Version:
95 lines (94 loc) 3.3 kB
import { DocumentMode } from 'parse5'; export declare class DomNode { static readonly treeAdapter: import("parse5").TypedTreeAdapter<import("./dom-tree-adapter").DomTreeAdapterTypeMap>; nodeName: string; parentNode?: DomParentNode; childNodes?: DomChildNode[]; get index(): number; get indexOfElement(): number; get firstChild(): DomChildNode; get textContent(): string; set textContent(value: string); get parentElement(): DomElement; get previousElementSibling(): DomElement; get nextElementSibling(): DomElement; previousSibling(): DomNode; nextSibling(): DomNode; appendChild(child: DomChildNode): void; insertBefore(newNode: DomChildNode, referenceNode: DomChildNode): void; } export declare class DomAttr { name: string; value: string; } export declare class DomChildNode extends DomNode { remove(): void; } export declare class DomParentNode extends DomChildNode { get children(): DomElement[]; prepend(node: DomChildNode): void; querySelectorAll<T extends DomElement = DomElement>(selector: DomSelector): T[]; querySelector<T extends DomElement = DomElement>(selector: DomSelector): T; } export declare class DomComment extends DomChildNode { data: string; nodeName: '#comment'; constructor(data: string); } export declare class DomDocument extends DomParentNode { nodeName: '#document'; mode: DocumentMode; get head(): DomElement; get body(): DomElement; get title(): string; set title(value: string); private get titleElement(); toHtml(): string; isFragment(): boolean; static parse(content: string): DomDocument; } export declare class DomDocumentFragment extends DomParentNode { nodeName: '#document-fragment'; toHtml(): string; static parse(content: string): DomDocumentFragment; } export declare class DomDocumentType extends DomChildNode { name: string; publicId: string; systemId: string; nodeName: '#documentType'; constructor(name: string, publicId: string, systemId: string); } export declare class DomElement extends DomParentNode implements DomChildNode { tagName: string; attrs: DomAttr[]; namespaceURI: string; constructor(tagName: string, attrs?: DomAttr[], namespaceURI?: string); get innerHTML(): string; set innerHTML(html: string); get outerHTML(): string; get className(): string; get templateContent(): DomDocumentFragment; getAttributeNode(name: string): DomAttr; getAttribute(name: string): string; hasAttribute(name: string): boolean; setAttribute(name: string, value: string): void; setAttributes(...domAttrs: DomAttr[]): void; removeAttribute(name: string): void; isSameTag(element: DomElement): boolean; isTagOf(...names: string[]): boolean; } export declare class DomText extends DomChildNode { value: string; nodeName: '#text'; constructor(value: string); } export declare class DomTableElement extends DomElement { } export declare class DomTableCellElement extends DomElement { } export declare class DomTableRowElement extends DomElement { get cells(): DomTableCellElement[]; } export declare type DomSelector = (node: DomElement) => boolean; export declare const defaultSelectors: DomSelector[];