UNPKG

1.68 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { ASTNode as Node } from 'parse5';
15export { ASTNode as Node } from 'parse5';
16export declare type Predicate = (node: Node) => boolean;
17export declare function hasSpaceSeparatedAttrValue(name: string, value: string): Predicate;
18export declare function isDocument(node: Node): boolean;
19export declare function isDocumentFragment(node: Node): boolean;
20export declare function isElement(node: Node): boolean;
21export declare function isTextNode(node: Node): boolean;
22export declare function isCommentNode(node: Node): boolean;
23export declare const predicates: {
24 hasClass: (name: string) => Predicate;
25 hasAttr: (attr: string) => Predicate;
26 hasAttrValue: (attr: string, value: string) => Predicate;
27 hasMatchingTagName: (regex: RegExp) => Predicate;
28 hasSpaceSeparatedAttrValue: typeof hasSpaceSeparatedAttrValue;
29 hasTagName: (name: string) => Predicate;
30 hasTextValue: (value: string) => Predicate;
31 AND: (...predicates: Predicate[]) => Predicate;
32 OR: (...predicates: Predicate[]) => Predicate;
33 NOT: (predicateFn: Predicate) => Predicate;
34 parentMatches: (predicateFn: Predicate) => Predicate;
35};