UNPKG

5.69 kBTypeScriptView Raw
1/** All valid namespaces in HTML. */
2export declare enum NS {
3 HTML = "http://www.w3.org/1999/xhtml",
4 MATHML = "http://www.w3.org/1998/Math/MathML",
5 SVG = "http://www.w3.org/2000/svg",
6 XLINK = "http://www.w3.org/1999/xlink",
7 XML = "http://www.w3.org/XML/1998/namespace",
8 XMLNS = "http://www.w3.org/2000/xmlns/"
9}
10export declare enum ATTRS {
11 TYPE = "type",
12 ACTION = "action",
13 ENCODING = "encoding",
14 PROMPT = "prompt",
15 NAME = "name",
16 COLOR = "color",
17 FACE = "face",
18 SIZE = "size"
19}
20/**
21 * The mode of the document.
22 *
23 * @see {@link https://dom.spec.whatwg.org/#concept-document-limited-quirks}
24 */
25export declare enum DOCUMENT_MODE {
26 NO_QUIRKS = "no-quirks",
27 QUIRKS = "quirks",
28 LIMITED_QUIRKS = "limited-quirks"
29}
30export declare enum TAG_NAMES {
31 A = "a",
32 ADDRESS = "address",
33 ANNOTATION_XML = "annotation-xml",
34 APPLET = "applet",
35 AREA = "area",
36 ARTICLE = "article",
37 ASIDE = "aside",
38 B = "b",
39 BASE = "base",
40 BASEFONT = "basefont",
41 BGSOUND = "bgsound",
42 BIG = "big",
43 BLOCKQUOTE = "blockquote",
44 BODY = "body",
45 BR = "br",
46 BUTTON = "button",
47 CAPTION = "caption",
48 CENTER = "center",
49 CODE = "code",
50 COL = "col",
51 COLGROUP = "colgroup",
52 DD = "dd",
53 DESC = "desc",
54 DETAILS = "details",
55 DIALOG = "dialog",
56 DIR = "dir",
57 DIV = "div",
58 DL = "dl",
59 DT = "dt",
60 EM = "em",
61 EMBED = "embed",
62 FIELDSET = "fieldset",
63 FIGCAPTION = "figcaption",
64 FIGURE = "figure",
65 FONT = "font",
66 FOOTER = "footer",
67 FOREIGN_OBJECT = "foreignObject",
68 FORM = "form",
69 FRAME = "frame",
70 FRAMESET = "frameset",
71 H1 = "h1",
72 H2 = "h2",
73 H3 = "h3",
74 H4 = "h4",
75 H5 = "h5",
76 H6 = "h6",
77 HEAD = "head",
78 HEADER = "header",
79 HGROUP = "hgroup",
80 HR = "hr",
81 HTML = "html",
82 I = "i",
83 IMG = "img",
84 IMAGE = "image",
85 INPUT = "input",
86 IFRAME = "iframe",
87 KEYGEN = "keygen",
88 LABEL = "label",
89 LI = "li",
90 LINK = "link",
91 LISTING = "listing",
92 MAIN = "main",
93 MALIGNMARK = "malignmark",
94 MARQUEE = "marquee",
95 MATH = "math",
96 MENU = "menu",
97 META = "meta",
98 MGLYPH = "mglyph",
99 MI = "mi",
100 MO = "mo",
101 MN = "mn",
102 MS = "ms",
103 MTEXT = "mtext",
104 NAV = "nav",
105 NOBR = "nobr",
106 NOFRAMES = "noframes",
107 NOEMBED = "noembed",
108 NOSCRIPT = "noscript",
109 OBJECT = "object",
110 OL = "ol",
111 OPTGROUP = "optgroup",
112 OPTION = "option",
113 P = "p",
114 PARAM = "param",
115 PLAINTEXT = "plaintext",
116 PRE = "pre",
117 RB = "rb",
118 RP = "rp",
119 RT = "rt",
120 RTC = "rtc",
121 RUBY = "ruby",
122 S = "s",
123 SCRIPT = "script",
124 SEARCH = "search",
125 SECTION = "section",
126 SELECT = "select",
127 SOURCE = "source",
128 SMALL = "small",
129 SPAN = "span",
130 STRIKE = "strike",
131 STRONG = "strong",
132 STYLE = "style",
133 SUB = "sub",
134 SUMMARY = "summary",
135 SUP = "sup",
136 TABLE = "table",
137 TBODY = "tbody",
138 TEMPLATE = "template",
139 TEXTAREA = "textarea",
140 TFOOT = "tfoot",
141 TD = "td",
142 TH = "th",
143 THEAD = "thead",
144 TITLE = "title",
145 TR = "tr",
146 TRACK = "track",
147 TT = "tt",
148 U = "u",
149 UL = "ul",
150 SVG = "svg",
151 VAR = "var",
152 WBR = "wbr",
153 XMP = "xmp"
154}
155/**
156 * Tag IDs are numeric IDs for known tag names.
157 *
158 * We use tag IDs to improve the performance of tag name comparisons.
159 */
160export declare enum TAG_ID {
161 UNKNOWN = 0,
162 A = 1,
163 ADDRESS = 2,
164 ANNOTATION_XML = 3,
165 APPLET = 4,
166 AREA = 5,
167 ARTICLE = 6,
168 ASIDE = 7,
169 B = 8,
170 BASE = 9,
171 BASEFONT = 10,
172 BGSOUND = 11,
173 BIG = 12,
174 BLOCKQUOTE = 13,
175 BODY = 14,
176 BR = 15,
177 BUTTON = 16,
178 CAPTION = 17,
179 CENTER = 18,
180 CODE = 19,
181 COL = 20,
182 COLGROUP = 21,
183 DD = 22,
184 DESC = 23,
185 DETAILS = 24,
186 DIALOG = 25,
187 DIR = 26,
188 DIV = 27,
189 DL = 28,
190 DT = 29,
191 EM = 30,
192 EMBED = 31,
193 FIELDSET = 32,
194 FIGCAPTION = 33,
195 FIGURE = 34,
196 FONT = 35,
197 FOOTER = 36,
198 FOREIGN_OBJECT = 37,
199 FORM = 38,
200 FRAME = 39,
201 FRAMESET = 40,
202 H1 = 41,
203 H2 = 42,
204 H3 = 43,
205 H4 = 44,
206 H5 = 45,
207 H6 = 46,
208 HEAD = 47,
209 HEADER = 48,
210 HGROUP = 49,
211 HR = 50,
212 HTML = 51,
213 I = 52,
214 IMG = 53,
215 IMAGE = 54,
216 INPUT = 55,
217 IFRAME = 56,
218 KEYGEN = 57,
219 LABEL = 58,
220 LI = 59,
221 LINK = 60,
222 LISTING = 61,
223 MAIN = 62,
224 MALIGNMARK = 63,
225 MARQUEE = 64,
226 MATH = 65,
227 MENU = 66,
228 META = 67,
229 MGLYPH = 68,
230 MI = 69,
231 MO = 70,
232 MN = 71,
233 MS = 72,
234 MTEXT = 73,
235 NAV = 74,
236 NOBR = 75,
237 NOFRAMES = 76,
238 NOEMBED = 77,
239 NOSCRIPT = 78,
240 OBJECT = 79,
241 OL = 80,
242 OPTGROUP = 81,
243 OPTION = 82,
244 P = 83,
245 PARAM = 84,
246 PLAINTEXT = 85,
247 PRE = 86,
248 RB = 87,
249 RP = 88,
250 RT = 89,
251 RTC = 90,
252 RUBY = 91,
253 S = 92,
254 SCRIPT = 93,
255 SEARCH = 94,
256 SECTION = 95,
257 SELECT = 96,
258 SOURCE = 97,
259 SMALL = 98,
260 SPAN = 99,
261 STRIKE = 100,
262 STRONG = 101,
263 STYLE = 102,
264 SUB = 103,
265 SUMMARY = 104,
266 SUP = 105,
267 TABLE = 106,
268 TBODY = 107,
269 TEMPLATE = 108,
270 TEXTAREA = 109,
271 TFOOT = 110,
272 TD = 111,
273 TH = 112,
274 THEAD = 113,
275 TITLE = 114,
276 TR = 115,
277 TRACK = 116,
278 TT = 117,
279 U = 118,
280 UL = 119,
281 SVG = 120,
282 VAR = 121,
283 WBR = 122,
284 XMP = 123
285}
286export declare function getTagID(tagName: string): TAG_ID;
287export declare const SPECIAL_ELEMENTS: Record<NS, Set<TAG_ID>>;
288export declare const NUMBERED_HEADERS: Set<TAG_ID>;
289export declare function hasUnescapedText(tn: string, scriptingEnabled: boolean): boolean;