html-validate 7.15.0 → 7.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core.js +35 -6
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/test-utils.js.map +1 -1
- package/dist/es/core.js +35 -6
- package/dist/es/core.js.map +1 -1
- package/dist/es/test-utils.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/browser.d.ts +128 -5
- package/dist/types/index.d.ts +128 -5
- package/dist/types/test-utils.d.ts +2 -779
- package/package.json +1 -1
|
@@ -1,782 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DOM Attribute.
|
|
5
|
-
*
|
|
6
|
-
* Represents a HTML attribute. Can contain either a fixed static value or a
|
|
7
|
-
* placeholder for dynamic values (e.g. interpolated).
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export declare class Attribute {
|
|
12
|
-
/** Attribute name */
|
|
13
|
-
readonly key: string;
|
|
14
|
-
readonly value: string | DynamicValue | null;
|
|
15
|
-
readonly keyLocation: Location_2;
|
|
16
|
-
readonly valueLocation: Location_2 | null;
|
|
17
|
-
readonly originalAttribute?: string;
|
|
18
|
-
/**
|
|
19
|
-
* @param key - Attribute name.
|
|
20
|
-
* @param value - Attribute value. Set to `null` for boolean attributes.
|
|
21
|
-
* @param keyLocation - Source location of attribute name.
|
|
22
|
-
* @param valueLocation - Source location of attribute value.
|
|
23
|
-
* @param originalAttribute - If this attribute was dynamically added via a
|
|
24
|
-
* transformation (e.g. vuejs `:id` generating the `id` attribute) this
|
|
25
|
-
* parameter should be set to the attribute name of the source attribute (`:id`).
|
|
26
|
-
*/
|
|
27
|
-
constructor(key: string, value: null | string | DynamicValue | null, keyLocation: Location_2, valueLocation: Location_2 | null, originalAttribute?: string);
|
|
28
|
-
/**
|
|
29
|
-
* Flag set to true if the attribute value is static.
|
|
30
|
-
*/
|
|
31
|
-
get isStatic(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Flag set to true if the attribute value is dynamic.
|
|
34
|
-
*/
|
|
35
|
-
get isDynamic(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Test attribute value.
|
|
38
|
-
*
|
|
39
|
-
* @param pattern - Pattern to match value against. Can be a RegExp, literal
|
|
40
|
-
* string or an array of strings (returns true if any value matches the
|
|
41
|
-
* array).
|
|
42
|
-
* @param dynamicMatches - If true `DynamicValue` will always match, if false
|
|
43
|
-
* it never matches.
|
|
44
|
-
* @returns `true` if attribute value matches pattern.
|
|
45
|
-
*/
|
|
46
|
-
valueMatches(pattern: RegExp, dynamicMatches?: boolean): boolean;
|
|
47
|
-
valueMatches(pattern: string, dynamicMatches?: boolean): boolean;
|
|
48
|
-
valueMatches(pattern: string[], dynamicMatches?: boolean): boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Raw attribute data.
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export declare interface AttributeData {
|
|
57
|
-
/** Attribute name */
|
|
58
|
-
key: string;
|
|
59
|
-
/** Attribute value */
|
|
60
|
-
value: string | DynamicValue | null;
|
|
61
|
-
/** Quotation mark (if present) */
|
|
62
|
-
quote: '"' | "'" | null;
|
|
63
|
-
/** Original attribute name (when a dynamic attribute is used), e.g
|
|
64
|
-
* "ng-attr-foo" or "v-bind:foo" */
|
|
65
|
-
originalAttribute?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* Excluded from this release type: BaseToken */
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
export declare type CategoryOrTag = string;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
declare interface CSSStyleDeclaration_2 {
|
|
79
|
-
[key: string]: string;
|
|
80
|
-
}
|
|
81
|
-
export { CSSStyleDeclaration_2 as CSSStyleDeclaration }
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
|
-
export declare interface DeprecatedElement {
|
|
87
|
-
message?: string;
|
|
88
|
-
documentation?: string;
|
|
89
|
-
source?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
export declare type DOMInternalID = number;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare class DOMNode {
|
|
101
|
-
readonly nodeName: string;
|
|
102
|
-
readonly nodeType: NodeType;
|
|
103
|
-
readonly childNodes: DOMNode[];
|
|
104
|
-
readonly location: Location_2;
|
|
105
|
-
/* Excluded from this release type: unique */
|
|
106
|
-
private cache;
|
|
107
|
-
/**
|
|
108
|
-
* Set of disabled rules for this node.
|
|
109
|
-
*
|
|
110
|
-
* Rules disabled by using directives are added here.
|
|
111
|
-
*/
|
|
112
|
-
private disabledRules;
|
|
113
|
-
/**
|
|
114
|
-
* Set of blocked rules for this node.
|
|
115
|
-
*
|
|
116
|
-
* Rules blocked by using directives are added here.
|
|
117
|
-
*/
|
|
118
|
-
private blockedRules;
|
|
119
|
-
/**
|
|
120
|
-
* Create a new DOMNode.
|
|
121
|
-
*
|
|
122
|
-
* @param nodeType - What node type to create.
|
|
123
|
-
* @param nodeName - What node name to use. For `HtmlElement` this corresponds
|
|
124
|
-
* to the tagName but other node types have specific predefined values.
|
|
125
|
-
* @param location - Source code location of this node.
|
|
126
|
-
*/
|
|
127
|
-
constructor(nodeType: NodeType, nodeName: string | undefined, location: Location_2);
|
|
128
|
-
/* Excluded from this release type: cacheEnable */
|
|
129
|
-
/**
|
|
130
|
-
* Fetch cached value from this DOM node.
|
|
131
|
-
*
|
|
132
|
-
* Cache is not enabled until `cacheEnable()` is called by [[Parser]] (when
|
|
133
|
-
* the element is fully constructed).
|
|
134
|
-
*
|
|
135
|
-
* @returns value or `undefined` if the value doesn't exist.
|
|
136
|
-
*/
|
|
137
|
-
cacheGet<K extends keyof DOMNodeCache>(key: K): DOMNodeCache[K] | undefined;
|
|
138
|
-
cacheGet(key: string | number | symbol): any | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* Store a value in cache.
|
|
141
|
-
*
|
|
142
|
-
* @returns the value itself is returned.
|
|
143
|
-
*/
|
|
144
|
-
cacheSet<K extends keyof DOMNodeCache>(key: K, value: DOMNodeCache[K]): DOMNodeCache[K];
|
|
145
|
-
cacheSet<T>(key: string | number | symbol, value: T): T;
|
|
146
|
-
/**
|
|
147
|
-
* Remove a value by key from cache.
|
|
148
|
-
*
|
|
149
|
-
* @returns `true` if the entry existed and has been removed.
|
|
150
|
-
*/
|
|
151
|
-
cacheRemove<K extends keyof DOMNodeCache>(key: K): boolean;
|
|
152
|
-
cacheRemove(key: string | number | symbol): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Check if key exists in cache.
|
|
155
|
-
*/
|
|
156
|
-
cacheExists<K extends keyof DOMNodeCache>(key: K): boolean;
|
|
157
|
-
cacheExists(key: string | number | symbol): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Get the text (recursive) from all child nodes.
|
|
160
|
-
*/
|
|
161
|
-
get textContent(): string;
|
|
162
|
-
append(node: DOMNode): void;
|
|
163
|
-
isRootElement(): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Tests if two nodes are the same (references the same object).
|
|
166
|
-
*/
|
|
167
|
-
isSameNode(otherNode: DOMNode): boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Returns a DOMNode representing the first direct child node or `null` if the
|
|
170
|
-
* node has no children.
|
|
171
|
-
*/
|
|
172
|
-
get firstChild(): DOMNode;
|
|
173
|
-
/**
|
|
174
|
-
* Returns a DOMNode representing the last direct child node or `null` if the
|
|
175
|
-
* node has no children.
|
|
176
|
-
*/
|
|
177
|
-
get lastChild(): DOMNode;
|
|
178
|
-
/* Excluded from this release type: blockRule */
|
|
179
|
-
/* Excluded from this release type: blockRules */
|
|
180
|
-
/* Excluded from this release type: disableRule */
|
|
181
|
-
/* Excluded from this release type: disableRules */
|
|
182
|
-
/**
|
|
183
|
-
* Enable a previously disabled rule for this node.
|
|
184
|
-
*/
|
|
185
|
-
enableRule(ruleId: string): void;
|
|
186
|
-
/**
|
|
187
|
-
* Enables multiple rules.
|
|
188
|
-
*/
|
|
189
|
-
enableRules(rules: string[]): void;
|
|
190
|
-
/* Excluded from this release type: ruleEnabled */
|
|
191
|
-
/* Excluded from this release type: ruleBlockers */
|
|
192
|
-
generateSelector(): string | null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @public
|
|
197
|
-
*/
|
|
198
|
-
export declare interface DOMNodeCache {
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
declare class DOMTokenList_2 extends Array<string> {
|
|
205
|
-
readonly value: string;
|
|
206
|
-
private readonly locations;
|
|
207
|
-
constructor(value: string | DynamicValue | null, location: Location_2 | null);
|
|
208
|
-
item(n: number): string | undefined;
|
|
209
|
-
location(n: number): Location_2 | undefined;
|
|
210
|
-
contains(token: string): boolean;
|
|
211
|
-
iterator(): Generator<{
|
|
212
|
-
index: number;
|
|
213
|
-
item: string;
|
|
214
|
-
location: Location_2;
|
|
215
|
-
}>;
|
|
216
|
-
}
|
|
217
|
-
export { DOMTokenList_2 as DOMTokenList }
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* @public
|
|
221
|
-
*/
|
|
222
|
-
export declare class DynamicValue {
|
|
223
|
-
readonly expr: string;
|
|
224
|
-
constructor(expr: string);
|
|
225
|
-
toString(): string;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* @public
|
|
230
|
-
*/
|
|
231
|
-
export declare interface ElementTable {
|
|
232
|
-
[tagName: string]: MetaElement;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
export declare interface FormAssociated {
|
|
239
|
-
/** Listed elements have a name attribute and is listed in the form and fieldset elements property. */
|
|
240
|
-
listed: boolean;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* @public
|
|
245
|
-
*/
|
|
246
|
-
export declare class HtmlElement extends DOMNode {
|
|
247
|
-
readonly tagName: string;
|
|
248
|
-
readonly parent: HtmlElement | null;
|
|
249
|
-
readonly voidElement: boolean;
|
|
250
|
-
readonly depth: number;
|
|
251
|
-
closed: NodeClosed;
|
|
252
|
-
protected readonly attr: {
|
|
253
|
-
[key: string]: Attribute[];
|
|
254
|
-
};
|
|
255
|
-
private metaElement;
|
|
256
|
-
private annotation;
|
|
257
|
-
constructor(tagName: string | undefined, parent: HtmlElement | null, closed: NodeClosed, meta: MetaElement | null, location: Location_2);
|
|
258
|
-
/* Excluded from this release type: rootNode */
|
|
259
|
-
/* Excluded from this release type: fromTokens */
|
|
260
|
-
/**
|
|
261
|
-
* Returns annotated name if set or defaults to `<tagName>`.
|
|
262
|
-
*
|
|
263
|
-
* E.g. `my-annotation` or `<div>`.
|
|
264
|
-
*/
|
|
265
|
-
get annotatedName(): string;
|
|
266
|
-
/**
|
|
267
|
-
* Get list of IDs referenced by `aria-labelledby`.
|
|
268
|
-
*
|
|
269
|
-
* If the attribute is unset or empty this getter returns null.
|
|
270
|
-
* If the attribute is dynamic the original {@link DynamicValue} is returned.
|
|
271
|
-
*
|
|
272
|
-
* @public
|
|
273
|
-
*/
|
|
274
|
-
get ariaLabelledby(): string[] | DynamicValue | null;
|
|
275
|
-
/**
|
|
276
|
-
* Similar to childNodes but only elements.
|
|
277
|
-
*/
|
|
278
|
-
get childElements(): HtmlElement[];
|
|
279
|
-
/**
|
|
280
|
-
* Find the first ancestor matching a selector.
|
|
281
|
-
*
|
|
282
|
-
* Implementation of DOM specification of Element.closest(selectors).
|
|
283
|
-
*/
|
|
284
|
-
closest(selectors: string): HtmlElement | null;
|
|
285
|
-
/**
|
|
286
|
-
* Generate a DOM selector for this element. The returned selector will be
|
|
287
|
-
* unique inside the current document.
|
|
288
|
-
*/
|
|
289
|
-
generateSelector(): string | null;
|
|
290
|
-
/**
|
|
291
|
-
* Tests if this element has given tagname.
|
|
292
|
-
*
|
|
293
|
-
* If passing "*" this test will pass if any tagname is set.
|
|
294
|
-
*/
|
|
295
|
-
is(tagName: string): boolean;
|
|
296
|
-
/**
|
|
297
|
-
* Load new element metadata onto this element.
|
|
298
|
-
*
|
|
299
|
-
* Do note that semantics such as `void` cannot be changed (as the element has
|
|
300
|
-
* already been created). In addition the element will still "be" the same
|
|
301
|
-
* element, i.e. even if loading meta for a `<p>` tag upon a `<div>` tag it
|
|
302
|
-
* will still be a `<div>` as far as the rest of the validator is concerned.
|
|
303
|
-
*
|
|
304
|
-
* In fact only certain properties will be copied onto the element:
|
|
305
|
-
*
|
|
306
|
-
* - content categories (flow, phrasing, etc)
|
|
307
|
-
* - required attributes
|
|
308
|
-
* - attribute allowed values
|
|
309
|
-
* - permitted/required elements
|
|
310
|
-
*
|
|
311
|
-
* Properties *not* loaded:
|
|
312
|
-
*
|
|
313
|
-
* - inherit
|
|
314
|
-
* - deprecated
|
|
315
|
-
* - foreign
|
|
316
|
-
* - void
|
|
317
|
-
* - implicitClosed
|
|
318
|
-
* - scriptSupporting
|
|
319
|
-
* - deprecatedAttributes
|
|
320
|
-
*
|
|
321
|
-
* Changes to element metadata will only be visible after `element:ready` (and
|
|
322
|
-
* the subsequent `dom:ready` event).
|
|
323
|
-
*/
|
|
324
|
-
loadMeta(meta: MetaElement): void;
|
|
325
|
-
/**
|
|
326
|
-
* Match this element against given selectors. Returns true if any selector
|
|
327
|
-
* matches.
|
|
328
|
-
*
|
|
329
|
-
* Implementation of DOM specification of Element.matches(selectors).
|
|
330
|
-
*/
|
|
331
|
-
matches(selector: string): boolean;
|
|
332
|
-
get meta(): MetaElement | null;
|
|
333
|
-
/**
|
|
334
|
-
* Set annotation for this element.
|
|
335
|
-
*/
|
|
336
|
-
setAnnotation(text: string): void;
|
|
337
|
-
/**
|
|
338
|
-
* Set attribute. Stores all attributes set even with the same name.
|
|
339
|
-
*
|
|
340
|
-
* @param key - Attribute name
|
|
341
|
-
* @param value - Attribute value. Use `null` if no value is present.
|
|
342
|
-
* @param keyLocation - Location of the attribute name.
|
|
343
|
-
* @param valueLocation - Location of the attribute value (excluding quotation)
|
|
344
|
-
* @param originalAttribute - If attribute is an alias for another attribute
|
|
345
|
-
* (dynamic attributes) set this to the original attribute name.
|
|
346
|
-
*/
|
|
347
|
-
setAttribute(key: string, value: string | DynamicValue | null, keyLocation: Location_2, valueLocation: Location_2 | null, originalAttribute?: string): void;
|
|
348
|
-
/**
|
|
349
|
-
* Get a list of all attributes on this node.
|
|
350
|
-
*/
|
|
351
|
-
get attributes(): Attribute[];
|
|
352
|
-
hasAttribute(key: string): boolean;
|
|
353
|
-
/**
|
|
354
|
-
* Get attribute.
|
|
355
|
-
*
|
|
356
|
-
* By default only the first attribute is returned but if the code needs to
|
|
357
|
-
* handle duplicate attributes the `all` parameter can be set to get all
|
|
358
|
-
* attributes with given key.
|
|
359
|
-
*
|
|
360
|
-
* This usually only happens when code contains duplicate attributes (which
|
|
361
|
-
* `no-dup-attr` will complain about) or when a static attribute is combined
|
|
362
|
-
* with a dynamic, consider:
|
|
363
|
-
*
|
|
364
|
-
* <p class="foo" dynamic-class="bar">
|
|
365
|
-
*
|
|
366
|
-
* @param key - Attribute name
|
|
367
|
-
* @param all - Return single or all attributes.
|
|
368
|
-
*/
|
|
369
|
-
getAttribute(key: string): Attribute | null;
|
|
370
|
-
getAttribute(key: string, all: true): Attribute[];
|
|
371
|
-
/**
|
|
372
|
-
* Get attribute value.
|
|
373
|
-
*
|
|
374
|
-
* Returns the attribute value if present.
|
|
375
|
-
*
|
|
376
|
-
* - Missing attributes return `null`.
|
|
377
|
-
* - Boolean attributes return `null`.
|
|
378
|
-
* - `DynamicValue` returns attribute expression.
|
|
379
|
-
*
|
|
380
|
-
* @param key - Attribute name
|
|
381
|
-
* @returns Attribute value or null.
|
|
382
|
-
*/
|
|
383
|
-
getAttributeValue(key: string): string | null;
|
|
384
|
-
/**
|
|
385
|
-
* Add text as a child node to this element.
|
|
386
|
-
*
|
|
387
|
-
* @param text - Text to add.
|
|
388
|
-
* @param location - Source code location of this text.
|
|
389
|
-
*/
|
|
390
|
-
appendText(text: string | DynamicValue, location: Location_2): void;
|
|
391
|
-
/**
|
|
392
|
-
* Return a list of all known classes on the element. Dynamic values are
|
|
393
|
-
* ignored.
|
|
394
|
-
*/
|
|
395
|
-
get classList(): DOMTokenList_2;
|
|
396
|
-
/**
|
|
397
|
-
* Get element ID if present.
|
|
398
|
-
*/
|
|
399
|
-
get id(): string | null;
|
|
400
|
-
get style(): CSSStyleDeclaration_2;
|
|
401
|
-
/**
|
|
402
|
-
* Returns the first child element or null if there are no child elements.
|
|
403
|
-
*/
|
|
404
|
-
get firstElementChild(): HtmlElement | null;
|
|
405
|
-
/**
|
|
406
|
-
* Returns the last child element or null if there are no child elements.
|
|
407
|
-
*/
|
|
408
|
-
get lastElementChild(): HtmlElement | null;
|
|
409
|
-
get siblings(): HtmlElement[];
|
|
410
|
-
get previousSibling(): HtmlElement | null;
|
|
411
|
-
get nextSibling(): HtmlElement | null;
|
|
412
|
-
getElementsByTagName(tagName: string): HtmlElement[];
|
|
413
|
-
querySelector(selector: string): HtmlElement | null;
|
|
414
|
-
querySelectorAll(selector: string): HtmlElement[];
|
|
415
|
-
private querySelectorImpl;
|
|
416
|
-
/* Excluded from this release type: visitDepthFirst */
|
|
417
|
-
/* Excluded from this release type: someChildren */
|
|
418
|
-
/* Excluded from this release type: everyChildren */
|
|
419
|
-
/* Excluded from this release type: find */
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* @public
|
|
424
|
-
*/
|
|
425
|
-
declare interface Location_2 {
|
|
426
|
-
/**
|
|
427
|
-
* The filemane this location refers to.
|
|
428
|
-
*/
|
|
429
|
-
readonly filename: string;
|
|
430
|
-
/**
|
|
431
|
-
* The string offset (number of characters into the string) this location
|
|
432
|
-
* refers to.
|
|
433
|
-
*/
|
|
434
|
-
readonly offset: number;
|
|
435
|
-
/**
|
|
436
|
-
* The line number in the file.
|
|
437
|
-
*/
|
|
438
|
-
readonly line: number;
|
|
439
|
-
/**
|
|
440
|
-
* The column number in the file. Tabs counts as 1 (not expanded).
|
|
441
|
-
*/
|
|
442
|
-
readonly column: number;
|
|
443
|
-
/**
|
|
444
|
-
* The number of characters this location refers to. This includes any
|
|
445
|
-
* whitespace characters such as newlines.
|
|
446
|
-
*/
|
|
447
|
-
readonly size: number;
|
|
448
|
-
}
|
|
449
|
-
export { Location_2 as Location }
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* @public
|
|
453
|
-
*/
|
|
454
|
-
export declare interface MetaAttribute {
|
|
455
|
-
allowed?: MetaAttributeAllowedCallback;
|
|
456
|
-
boolean?: boolean;
|
|
457
|
-
deprecated?: boolean | string;
|
|
458
|
-
enum?: Array<string | RegExp>;
|
|
459
|
-
list?: boolean;
|
|
460
|
-
omit?: boolean;
|
|
461
|
-
required?: boolean;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Callback for the `allowed` property of `MetaAttribute`. It takes a node and
|
|
466
|
-
* should return `null` if there is no errors and a string with an error
|
|
467
|
-
* description if there is an error.
|
|
468
|
-
*
|
|
469
|
-
* @public
|
|
470
|
-
* @param node - The node the attribute belongs to.
|
|
471
|
-
* @param attr - The current attribute being validated.
|
|
472
|
-
*/
|
|
473
|
-
export declare type MetaAttributeAllowedCallback = (node: HtmlElement, attr: Attribute) => string | null | undefined;
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* @public
|
|
477
|
-
*/
|
|
478
|
-
export declare interface MetaData {
|
|
479
|
-
inherit?: string;
|
|
480
|
-
metadata?: boolean | PropertyExpression;
|
|
481
|
-
flow?: boolean | PropertyExpression;
|
|
482
|
-
sectioning?: boolean | PropertyExpression;
|
|
483
|
-
heading?: boolean | PropertyExpression;
|
|
484
|
-
phrasing?: boolean | PropertyExpression;
|
|
485
|
-
embedded?: boolean | PropertyExpression;
|
|
486
|
-
interactive?: boolean | PropertyExpression;
|
|
487
|
-
deprecated?: boolean | string | DeprecatedElement;
|
|
488
|
-
foreign?: boolean;
|
|
489
|
-
void?: boolean;
|
|
490
|
-
transparent?: boolean | string[];
|
|
491
|
-
implicitClosed?: string[];
|
|
492
|
-
scriptSupporting?: boolean;
|
|
493
|
-
form?: boolean;
|
|
494
|
-
/** Mark element as a form-associated element */
|
|
495
|
-
formAssociated?: Partial<FormAssociated>;
|
|
496
|
-
labelable?: boolean | PropertyExpression;
|
|
497
|
-
deprecatedAttributes?: string[];
|
|
498
|
-
requiredAttributes?: string[];
|
|
499
|
-
attributes?: PermittedAttribute;
|
|
500
|
-
permittedContent?: Permitted;
|
|
501
|
-
permittedDescendants?: Permitted;
|
|
502
|
-
permittedOrder?: PermittedOrder;
|
|
503
|
-
permittedParent?: Permitted;
|
|
504
|
-
requiredAncestors?: RequiredAncestors;
|
|
505
|
-
requiredContent?: RequiredContent;
|
|
506
|
-
textContent?: TextContent | `${TextContent}`;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* @public
|
|
511
|
-
*/
|
|
512
|
-
export declare interface MetaElement extends Omit<MetaData, "deprecatedAttributes" | "requiredAttributes"> {
|
|
513
|
-
tagName: string;
|
|
514
|
-
formAssociated?: FormAssociated;
|
|
515
|
-
attributes: Record<string, MetaAttribute>;
|
|
516
|
-
textContent?: TextContent;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Properties listed here can be used to reverse search elements with the given
|
|
521
|
-
* property enabled. See [[MetaTable.getTagsWithProperty]].
|
|
522
|
-
*
|
|
523
|
-
* @public
|
|
524
|
-
*/
|
|
525
|
-
export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "form" | "formAssociated" | "labelable";
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* @public
|
|
529
|
-
*/
|
|
530
|
-
export declare class MetaTable {
|
|
531
|
-
readonly elements: ElementTable;
|
|
532
|
-
private schema;
|
|
533
|
-
/* Excluded from this release type: __constructor */
|
|
534
|
-
/* Excluded from this release type: init */
|
|
535
|
-
/* Excluded from this release type: extendValidationSchema */
|
|
536
|
-
/* Excluded from this release type: loadFromObject */
|
|
537
|
-
/* Excluded from this release type: loadFromFile */
|
|
538
|
-
/**
|
|
539
|
-
* Get [[MetaElement]] for the given tag. If no specific metadata is present
|
|
540
|
-
* the global metadata is returned or null if no global is present.
|
|
541
|
-
*
|
|
542
|
-
* @public
|
|
543
|
-
* @returns A shallow copy of metadata.
|
|
544
|
-
*/
|
|
545
|
-
getMetaFor(tagName: string): MetaElement | null;
|
|
546
|
-
/**
|
|
547
|
-
* Find all tags which has enabled given property.
|
|
548
|
-
*
|
|
549
|
-
* @public
|
|
550
|
-
*/
|
|
551
|
-
getTagsWithProperty(propName: MetaLookupableProperty): string[];
|
|
552
|
-
/**
|
|
553
|
-
* Find tag matching tagName or inheriting from it.
|
|
554
|
-
*
|
|
555
|
-
* @public
|
|
556
|
-
*/
|
|
557
|
-
getTagsDerivedFrom(tagName: string): string[];
|
|
558
|
-
private addEntry;
|
|
559
|
-
/**
|
|
560
|
-
* Construct a new AJV schema validator.
|
|
561
|
-
*/
|
|
562
|
-
private getSchemaValidator;
|
|
563
|
-
/**
|
|
564
|
-
* @public
|
|
565
|
-
*/
|
|
566
|
-
getJSONSchema(): SchemaObject;
|
|
567
|
-
/**
|
|
568
|
-
* Finds the global element definition and merges each known element with the
|
|
569
|
-
* global, e.g. to assign global attributes.
|
|
570
|
-
*/
|
|
571
|
-
private resolveGlobal;
|
|
572
|
-
private mergeElement;
|
|
573
|
-
/* Excluded from this release type: resolve */
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* @public
|
|
578
|
-
*/
|
|
579
|
-
export declare enum NodeClosed {
|
|
580
|
-
Open = 0,
|
|
581
|
-
EndTag = 1,
|
|
582
|
-
VoidOmitted = 2,
|
|
583
|
-
VoidSelfClosed = 3,
|
|
584
|
-
ImplicitClosed = 4
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* @public
|
|
589
|
-
*/
|
|
590
|
-
export declare enum NodeType {
|
|
591
|
-
ELEMENT_NODE = 1,
|
|
592
|
-
TEXT_NODE = 3,
|
|
593
|
-
DOCUMENT_NODE = 9
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* @public
|
|
598
|
-
*/
|
|
599
|
-
export declare type Permitted = PermittedEntry[];
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* @public
|
|
603
|
-
*/
|
|
604
|
-
export declare type PermittedAttribute = Record<string, MetaAttribute | Array<string | RegExp> | null>;
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* @public
|
|
608
|
-
*/
|
|
609
|
-
export declare type PermittedEntry = CategoryOrTag | PermittedGroup | Array<CategoryOrTag | PermittedGroup>;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* @public
|
|
613
|
-
*/
|
|
614
|
-
export declare interface PermittedGroup {
|
|
615
|
-
exclude?: string | string[];
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @public
|
|
620
|
-
*/
|
|
621
|
-
export declare type PermittedOrder = string[];
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* @public
|
|
625
|
-
*/
|
|
626
|
-
export declare type ProcessAttributeCallback = (this: unknown, attr: AttributeData) => Iterable<AttributeData>;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* @public
|
|
630
|
-
*/
|
|
631
|
-
export declare type ProcessElementCallback = (this: ProcessElementContext, node: HtmlElement) => void;
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* @public
|
|
635
|
-
*/
|
|
636
|
-
export declare interface ProcessElementContext {
|
|
637
|
-
getMetaFor(this: void, tagName: string): MetaElement | null;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* @public
|
|
642
|
-
*/
|
|
643
|
-
export declare type PropertyExpression = string | [string, any];
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* @public
|
|
647
|
-
*/
|
|
648
|
-
export declare type RequiredAncestors = string[];
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* @public
|
|
652
|
-
*/
|
|
653
|
-
export declare type RequiredContent = string[];
|
|
654
|
-
|
|
655
|
-
/* Excluded from this release type: RuleBlocker */
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* @public
|
|
659
|
-
*/
|
|
660
|
-
export declare interface SchemaValidationPatch {
|
|
661
|
-
properties?: Record<string, unknown>;
|
|
662
|
-
definitions?: Record<string, unknown>;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* Source interface.
|
|
667
|
-
*
|
|
668
|
-
* HTML source with file, line and column context.
|
|
669
|
-
*
|
|
670
|
-
* Optional hooks can be attached. This is usually added by transformers to
|
|
671
|
-
* postprocess.
|
|
672
|
-
*
|
|
673
|
-
* @public
|
|
674
|
-
*/
|
|
675
|
-
export declare interface Source {
|
|
676
|
-
data: string;
|
|
677
|
-
filename: string;
|
|
678
|
-
/**
|
|
679
|
-
* Line in the original data.
|
|
680
|
-
*
|
|
681
|
-
* Starts at 1 (first line).
|
|
682
|
-
*/
|
|
683
|
-
line: number;
|
|
684
|
-
/**
|
|
685
|
-
* Column in the original data.
|
|
686
|
-
*
|
|
687
|
-
* Starts at 1 (first column).
|
|
688
|
-
*/
|
|
689
|
-
column: number;
|
|
690
|
-
/**
|
|
691
|
-
* Offset in the original data.
|
|
692
|
-
*
|
|
693
|
-
* Starts at 0 (first character).
|
|
694
|
-
*/
|
|
695
|
-
offset: number;
|
|
696
|
-
/**
|
|
697
|
-
* Original data. When a transformer extracts a portion of the original source
|
|
698
|
-
* this must be set to the full original source.
|
|
699
|
-
*
|
|
700
|
-
* Since the transformer might be chained always test if the input source
|
|
701
|
-
* itself has `originalData` set, e.g.:
|
|
702
|
-
*
|
|
703
|
-
* `originalData = input.originalData || input.data`.
|
|
704
|
-
*/
|
|
705
|
-
originalData?: string;
|
|
706
|
-
/**
|
|
707
|
-
* Hooks for processing the source as it is being parsed.
|
|
708
|
-
*/
|
|
709
|
-
hooks?: SourceHooks;
|
|
710
|
-
/**
|
|
711
|
-
* Internal property to keep track of what transformers has run on this
|
|
712
|
-
* source. Entries are in reverse-order, e.g. the last applied transform is
|
|
713
|
-
* first.
|
|
714
|
-
*/
|
|
715
|
-
transformedBy?: string[];
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @public
|
|
720
|
-
*/
|
|
721
|
-
export declare interface SourceHooks {
|
|
722
|
-
/**
|
|
723
|
-
* Called for every attribute.
|
|
724
|
-
*
|
|
725
|
-
* The original attribute must be yielded as well or no attribute will be
|
|
726
|
-
* added.
|
|
727
|
-
*
|
|
728
|
-
* @returns Attribute data for an attribute to be added to the element.
|
|
729
|
-
*/
|
|
730
|
-
processAttribute?: ProcessAttributeCallback | null;
|
|
731
|
-
/**
|
|
732
|
-
* Called for every element after element is created but before any children.
|
|
733
|
-
*
|
|
734
|
-
* May modify the element.
|
|
735
|
-
*/
|
|
736
|
-
processElement?: ProcessElementCallback | null;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/* Excluded from this release type: TagCloseToken */
|
|
740
|
-
|
|
741
|
-
/* Excluded from this release type: TagOpenToken */
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* @public
|
|
745
|
-
*/
|
|
746
|
-
export declare enum TextContent {
|
|
747
|
-
NONE = "none",
|
|
748
|
-
DEFAULT = "default",
|
|
749
|
-
REQUIRED = "required",
|
|
750
|
-
ACCESSIBLE = "accessible"
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/* Excluded from this release type: TokenType */
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* @public
|
|
757
|
-
*/
|
|
758
|
-
export declare interface TransformContext {
|
|
759
|
-
/**
|
|
760
|
-
* Test if an additional chainable transformer is present.
|
|
761
|
-
*
|
|
762
|
-
* Returns true only if there is a transformer configured for the given
|
|
763
|
-
* filename.
|
|
764
|
-
*
|
|
765
|
-
* @param filename - Filename to use to match next transformer.
|
|
766
|
-
*/
|
|
767
|
-
hasChain(filename: string): boolean;
|
|
768
|
-
/**
|
|
769
|
-
* Chain transformations.
|
|
770
|
-
*
|
|
771
|
-
* Sometimes multiple transformers must be applied. For instance, a Markdown
|
|
772
|
-
* file with JSX in a code-block.
|
|
773
|
-
*
|
|
774
|
-
* @param source - Source to chain transformations on.
|
|
775
|
-
* @param filename - Filename to use to match next transformer (unrelated to
|
|
776
|
-
* filename set in source)
|
|
777
|
-
*/
|
|
778
|
-
chain(source: Source, filename: string): Iterable<Source>;
|
|
779
|
-
}
|
|
1
|
+
import { Source } from 'html-validate';
|
|
2
|
+
import { TransformContext } from 'html-validate';
|
|
780
3
|
|
|
781
4
|
/**
|
|
782
5
|
* @public
|