domtranslator
Version:
Simple and powerful DOM translator.
18 lines (17 loc) • 839 B
TypeScript
export declare const isElementNode: (node: Node) => node is Element;
export declare const isAttributeNode: (node: Node) => node is Attr;
export declare const isTextNode: (node: Node) => node is Text;
export declare const searchParent: (node: Node, callback: (value: Node) => boolean, includeSelf?: boolean) => Node | null;
export type NodesFilterOptions = {
ignoredSelectors?: string[];
attributesList?: string[];
};
/**
* Configure and return a filter function for `Node` objects.
* Filter function returns `true` for nodes that match filter and `false` otherwise
*/
export declare const createNodesFilter: (config?: NodesFilterOptions) => (node: Node) => boolean;
/**
* Calculate node priority for translate, the bigger number the important a node text
*/
export declare function getNodeImportanceScore(node: Node): number;