UNPKG

1.77 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2016 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 * as dom5 from 'dom5/lib/index-next';
15import { ASTNode } from 'parse5';
16import { SourceRange } from '../model/model';
17import { ParsedDocument, StringifyOptions } from '../parser/document';
18/**
19 * The ASTs of the HTML elements needed to represent Polymer elements.
20 */
21export interface HtmlVisitor {
22 (node: ASTNode): void;
23}
24export declare class ParsedHtmlDocument extends ParsedDocument<ASTNode, HtmlVisitor> {
25 type: string;
26 visit(visitors: HtmlVisitor[]): void;
27 private _sourceRangeForElementWithEndTag;
28 protected _sourceRangeForNode(node: ASTNode): SourceRange | undefined;
29 sourceRangeForAttribute(node: ASTNode, attrName: string): SourceRange | undefined;
30 sourceRangeForAttributeName(node: ASTNode, attrName: string): SourceRange | undefined;
31 sourceRangeForAttributeValue(node: ASTNode, attrName: string, excludeQuotes?: boolean): SourceRange | undefined;
32 sourceRangeForStartTag(node: ASTNode): SourceRange | undefined;
33 sourceRangeForEndTag(node: ASTNode): SourceRange | undefined;
34 private _getSourceRangeForLocation;
35 private _findClonedContainingNode;
36 stringify(options?: StringifyOptions): string;
37}
38export declare function isFakeNode(ast: dom5.Node): boolean;