parse5 6.0.1 → 7.3.0

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.
Files changed (86) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/common/doctype.d.ts +4 -0
  3. package/dist/cjs/common/doctype.js +118 -0
  4. package/dist/cjs/common/error-codes.d.ts +67 -0
  5. package/dist/cjs/common/error-codes.js +66 -0
  6. package/dist/cjs/common/foreign-content.d.ts +9 -0
  7. package/dist/cjs/common/foreign-content.js +237 -0
  8. package/dist/cjs/common/html.d.ts +289 -0
  9. package/dist/cjs/common/html.js +528 -0
  10. package/dist/cjs/common/token.d.ts +84 -0
  11. package/dist/cjs/common/token.js +24 -0
  12. package/dist/cjs/common/unicode.d.ts +42 -0
  13. package/dist/cjs/common/unicode.js +70 -0
  14. package/dist/cjs/index.d.ts +71 -0
  15. package/dist/cjs/index.js +54 -0
  16. package/dist/cjs/package.json +1 -0
  17. package/dist/cjs/parser/formatting-element-list.d.ts +36 -0
  18. package/dist/cjs/parser/formatting-element-list.js +114 -0
  19. package/dist/cjs/parser/index.d.ts +221 -0
  20. package/dist/cjs/parser/index.js +3240 -0
  21. package/dist/cjs/parser/open-element-stack.d.ts +53 -0
  22. package/dist/cjs/parser/open-element-stack.js +328 -0
  23. package/dist/cjs/serializer/index.d.ts +60 -0
  24. package/dist/cjs/serializer/index.js +172 -0
  25. package/dist/cjs/tokenizer/index.d.ts +247 -0
  26. package/dist/cjs/tokenizer/index.js +2714 -0
  27. package/dist/cjs/tokenizer/preprocessor.d.ts +36 -0
  28. package/dist/cjs/tokenizer/preprocessor.js +200 -0
  29. package/dist/cjs/tree-adapters/default.d.ts +84 -0
  30. package/dist/cjs/tree-adapters/default.js +176 -0
  31. package/dist/cjs/tree-adapters/interface.d.ts +255 -0
  32. package/dist/cjs/tree-adapters/interface.js +2 -0
  33. package/dist/common/doctype.d.ts +4 -0
  34. package/{lib → dist}/common/doctype.js +24 -72
  35. package/dist/common/error-codes.d.ts +67 -0
  36. package/dist/common/error-codes.js +63 -0
  37. package/dist/common/foreign-content.d.ts +9 -0
  38. package/dist/common/foreign-content.js +228 -0
  39. package/dist/common/html.d.ts +289 -0
  40. package/dist/common/html.js +523 -0
  41. package/dist/common/token.d.ts +84 -0
  42. package/dist/common/token.js +20 -0
  43. package/dist/common/unicode.d.ts +42 -0
  44. package/dist/common/unicode.js +62 -0
  45. package/dist/index.d.ts +71 -0
  46. package/dist/index.js +42 -0
  47. package/dist/parser/formatting-element-list.d.ts +36 -0
  48. package/dist/parser/formatting-element-list.js +110 -0
  49. package/dist/parser/index.d.ts +221 -0
  50. package/dist/parser/index.js +3245 -0
  51. package/dist/parser/open-element-stack.d.ts +53 -0
  52. package/dist/parser/open-element-stack.js +324 -0
  53. package/dist/serializer/index.d.ts +60 -0
  54. package/dist/serializer/index.js +168 -0
  55. package/dist/tokenizer/index.d.ts +247 -0
  56. package/dist/tokenizer/index.js +2710 -0
  57. package/dist/tokenizer/preprocessor.d.ts +36 -0
  58. package/dist/tokenizer/preprocessor.js +196 -0
  59. package/dist/tree-adapters/default.d.ts +84 -0
  60. package/dist/tree-adapters/default.js +173 -0
  61. package/dist/tree-adapters/interface.d.ts +255 -0
  62. package/dist/tree-adapters/interface.js +1 -0
  63. package/package.json +21 -6
  64. package/lib/common/error-codes.js +0 -65
  65. package/lib/common/foreign-content.js +0 -265
  66. package/lib/common/html.js +0 -272
  67. package/lib/common/unicode.js +0 -109
  68. package/lib/extensions/error-reporting/mixin-base.js +0 -43
  69. package/lib/extensions/error-reporting/parser-mixin.js +0 -52
  70. package/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  71. package/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  72. package/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  73. package/lib/extensions/location-info/parser-mixin.js +0 -223
  74. package/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  75. package/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  76. package/lib/index.js +0 -29
  77. package/lib/parser/formatting-element-list.js +0 -181
  78. package/lib/parser/index.js +0 -2956
  79. package/lib/parser/open-element-stack.js +0 -482
  80. package/lib/serializer/index.js +0 -176
  81. package/lib/tokenizer/index.js +0 -2196
  82. package/lib/tokenizer/named-entity-data.js +0 -5
  83. package/lib/tokenizer/preprocessor.js +0 -159
  84. package/lib/tree-adapters/default.js +0 -221
  85. package/lib/utils/merge-options.js +0 -13
  86. package/lib/utils/mixin.js +0 -39
@@ -0,0 +1,255 @@
1
+ import type { DOCUMENT_MODE, NS } from '../common/html.js';
2
+ import type { Attribute, ElementLocation } from '../common/token.js';
3
+ export interface TreeAdapterTypeMap<Node = unknown, ParentNode = unknown, ChildNode = unknown, Document = unknown, DocumentFragment = unknown, Element = unknown, CommentNode = unknown, TextNode = unknown, Template = unknown, DocumentType = unknown> {
4
+ node: Node;
5
+ parentNode: ParentNode;
6
+ childNode: ChildNode;
7
+ document: Document;
8
+ documentFragment: DocumentFragment;
9
+ element: Element;
10
+ commentNode: CommentNode;
11
+ textNode: TextNode;
12
+ template: Template;
13
+ documentType: DocumentType;
14
+ }
15
+ /**
16
+ * Tree adapter is a set of utility functions that provides minimal required abstraction layer beetween parser and a specific AST format.
17
+ * Note that `TreeAdapter` is not designed to be a general purpose AST manipulation library. You can build such library
18
+ * on top of existing `TreeAdapter` or use one of the existing libraries from npm.
19
+ *
20
+ * @see Have a look at the default tree adapter for reference.
21
+ */
22
+ export interface TreeAdapter<T extends TreeAdapterTypeMap = TreeAdapterTypeMap> {
23
+ /**
24
+ * Copies attributes to the given element. Only attributes that are not yet present in the element are copied.
25
+ *
26
+ * @param recipient - Element to copy attributes into.
27
+ * @param attrs - Attributes to copy.
28
+ */
29
+ adoptAttributes(recipient: T['element'], attrs: Attribute[]): void;
30
+ /**
31
+ * Appends a child node to the given parent node.
32
+ *
33
+ * @param parentNode - Parent node.
34
+ * @param newNode - Child node.
35
+ */
36
+ appendChild(parentNode: T['parentNode'], newNode: T['childNode']): void;
37
+ /**
38
+ * Creates a comment node.
39
+ *
40
+ * @param data - Comment text.
41
+ */
42
+ createCommentNode(data: string): T['commentNode'];
43
+ /**
44
+ * Creates a text node.
45
+ *
46
+ * @param value - Text.
47
+ */
48
+ createTextNode(value: string): T['textNode'];
49
+ /**
50
+ * Creates a document node.
51
+ */
52
+ createDocument(): T['document'];
53
+ /**
54
+ * Creates a document fragment node.
55
+ */
56
+ createDocumentFragment(): T['documentFragment'];
57
+ /**
58
+ * Creates an element node.
59
+ *
60
+ * @param tagName - Tag name of the element.
61
+ * @param namespaceURI - Namespace of the element.
62
+ * @param attrs - Attribute name-value pair array. Foreign attributes may contain `namespace` and `prefix` fields as well.
63
+ */
64
+ createElement(tagName: string, namespaceURI: NS, attrs: Attribute[]): T['element'];
65
+ /**
66
+ * Removes a node from its parent.
67
+ *
68
+ * @param node - Node to remove.
69
+ */
70
+ detachNode(node: T['childNode']): void;
71
+ /**
72
+ * Returns the given element's attributes in an array, in the form of name-value pairs.
73
+ * Foreign attributes may contain `namespace` and `prefix` fields as well.
74
+ *
75
+ * @param element - Element.
76
+ */
77
+ getAttrList(element: T['element']): Attribute[];
78
+ /**
79
+ * Returns the given node's children in an array.
80
+ *
81
+ * @param node - Node.
82
+ */
83
+ getChildNodes(node: T['parentNode']): T['childNode'][];
84
+ /**
85
+ * Returns the given comment node's content.
86
+ *
87
+ * @param commentNode - Comment node.
88
+ */
89
+ getCommentNodeContent(commentNode: T['commentNode']): string;
90
+ /**
91
+ * Returns [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).
92
+ *
93
+ * @param document - Document node.
94
+ */
95
+ getDocumentMode(document: T['document']): DOCUMENT_MODE;
96
+ /**
97
+ * Returns the given document type node's name.
98
+ *
99
+ * @param doctypeNode - Document type node.
100
+ */
101
+ getDocumentTypeNodeName(doctypeNode: T['documentType']): string;
102
+ /**
103
+ * Returns the given document type node's public identifier.
104
+ *
105
+ * @param doctypeNode - Document type node.
106
+ */
107
+ getDocumentTypeNodePublicId(doctypeNode: T['documentType']): string;
108
+ /**
109
+ * Returns the given document type node's system identifier.
110
+ *
111
+ * @param doctypeNode - Document type node.
112
+ */
113
+ getDocumentTypeNodeSystemId(doctypeNode: T['documentType']): string;
114
+ /**
115
+ * Returns the first child of the given node.
116
+ *
117
+ * @param node - Node.
118
+ */
119
+ getFirstChild(node: T['parentNode']): T['childNode'] | null;
120
+ /**
121
+ * Returns the given element's namespace.
122
+ *
123
+ * @param element - Element.
124
+ */
125
+ getNamespaceURI(element: T['element']): NS;
126
+ /**
127
+ * Returns the given node's source code location information.
128
+ *
129
+ * @param node - Node.
130
+ */
131
+ getNodeSourceCodeLocation(node: T['node']): ElementLocation | undefined | null;
132
+ /**
133
+ * Returns the given node's parent.
134
+ *
135
+ * @param node - Node.
136
+ */
137
+ getParentNode(node: T['node']): T['parentNode'] | null;
138
+ /**
139
+ * Returns the given element's tag name.
140
+ *
141
+ * @param element - Element.
142
+ */
143
+ getTagName(element: T['element']): string;
144
+ /**
145
+ * Returns the given text node's content.
146
+ *
147
+ * @param textNode - Text node.
148
+ */
149
+ getTextNodeContent(textNode: T['textNode']): string;
150
+ /**
151
+ * Returns the `<template>` element content element.
152
+ *
153
+ * @param templateElement - `<template>` element.
154
+ */
155
+ getTemplateContent(templateElement: T['template']): T['documentFragment'];
156
+ /**
157
+ * Inserts a child node to the given parent node before the given reference node.
158
+ *
159
+ * @param parentNode - Parent node.
160
+ * @param newNode - Child node.
161
+ * @param referenceNode - Reference node.
162
+ */
163
+ insertBefore(parentNode: T['parentNode'], newNode: T['childNode'], referenceNode: T['childNode']): void;
164
+ /**
165
+ * Inserts text into a node. If the last child of the node is a text node, the provided text will be appended to the
166
+ * text node content. Otherwise, inserts a new text node with the given text.
167
+ *
168
+ * @param parentNode - Node to insert text into.
169
+ * @param text - Text to insert.
170
+ */
171
+ insertText(parentNode: T['parentNode'], text: string): void;
172
+ /**
173
+ * Inserts text into a sibling node that goes before the reference node. If this sibling node is the text node,
174
+ * the provided text will be appended to the text node content. Otherwise, inserts a new sibling text node with
175
+ * the given text before the reference node.
176
+ *
177
+ * @param parentNode - Node to insert text into.
178
+ * @param text - Text to insert.
179
+ * @param referenceNode - Node to insert text before.
180
+ */
181
+ insertTextBefore(parentNode: T['parentNode'], text: string, referenceNode: T['childNode']): void;
182
+ /**
183
+ * Determines if the given node is a comment node.
184
+ *
185
+ * @param node - Node.
186
+ */
187
+ isCommentNode(node: T['node']): node is T['commentNode'];
188
+ /**
189
+ * Determines if the given node is a document type node.
190
+ *
191
+ * @param node - Node.
192
+ */
193
+ isDocumentTypeNode(node: T['node']): node is T['documentType'];
194
+ /**
195
+ * Determines if the given node is an element.
196
+ *
197
+ * @param node - Node.
198
+ */
199
+ isElementNode(node: T['node']): node is T['element'];
200
+ /**
201
+ * Determines if the given node is a text node.
202
+ *
203
+ * @param node - Node.
204
+ */
205
+ isTextNode(node: T['node']): node is T['textNode'];
206
+ /**
207
+ * Sets the [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).
208
+ *
209
+ * @param document - Document node.
210
+ * @param mode - Document mode.
211
+ */
212
+ setDocumentMode(document: T['document'], mode: DOCUMENT_MODE): void;
213
+ /**
214
+ * Sets the document type. If the `document` already contains a document type node, the `name`, `publicId` and `systemId`
215
+ * properties of this node will be updated with the provided values. Otherwise, creates a new document type node
216
+ * with the given properties and inserts it into the `document`.
217
+ *
218
+ * @param document - Document node.
219
+ * @param name - Document type name.
220
+ * @param publicId - Document type public identifier.
221
+ * @param systemId - Document type system identifier.
222
+ */
223
+ setDocumentType(document: T['document'], name: string, publicId: string, systemId: string): void;
224
+ /**
225
+ * Attaches source code location information to the node.
226
+ *
227
+ * @param node - Node.
228
+ */
229
+ setNodeSourceCodeLocation(node: T['node'], location: ElementLocation | null): void;
230
+ /**
231
+ * Updates the source code location information of the node.
232
+ *
233
+ * @param node - Node.
234
+ */
235
+ updateNodeSourceCodeLocation(node: T['node'], location: Partial<ElementLocation>): void;
236
+ /**
237
+ * Sets the `<template>` element content element.
238
+ *
239
+ * @param templateElement - `<template>` element.
240
+ * @param contentElement - Content element.
241
+ */
242
+ setTemplateContent(templateElement: T['template'], contentElement: T['documentFragment']): void;
243
+ /**
244
+ * Optional callback for elements being pushed to the stack of open elements.
245
+ *
246
+ * @param element The element being pushed to the stack of open elements.
247
+ */
248
+ onItemPush?: (item: T['element']) => void;
249
+ /**
250
+ * Optional callback for elements being popped from the stack of open elements.
251
+ *
252
+ * @param item The element being popped.
253
+ */
254
+ onItemPop?: (item: T['element'], newTop: T['parentNode']) => void;
255
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { DOCUMENT_MODE } from './html.js';
2
+ import type { DoctypeToken } from './token.js';
3
+ export declare function isConforming(token: DoctypeToken): boolean;
4
+ export declare function getDocumentMode(token: DoctypeToken): DOCUMENT_MODE;
@@ -1,12 +1,8 @@
1
- 'use strict';
2
-
3
- const { DOCUMENT_MODE } = require('./html');
4
-
1
+ import { DOCUMENT_MODE } from './html.js';
5
2
  //Const
6
3
  const VALID_DOCTYPE_NAME = 'html';
7
4
  const VALID_SYSTEM_ID = 'about:legacy-compat';
8
5
  const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';
9
-
10
6
  const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
11
7
  '+//silmaril//dtd html pro v0r11 19970101//',
12
8
  '-//as//dtd html 3.0 aswedit + extensions//',
@@ -62,101 +58,57 @@ const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
62
58
  '-//w3c//dtd w3 html//',
63
59
  '-//w3o//dtd w3 html 3.0//',
64
60
  '-//webtechs//dtd mozilla html 2.0//',
65
- '-//webtechs//dtd mozilla html//'
61
+ '-//webtechs//dtd mozilla html//',
66
62
  ];
67
-
68
- const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([
63
+ const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
64
+ ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,
69
65
  '-//w3c//dtd html 4.01 frameset//',
70
- '-//w3c//dtd html 4.01 transitional//'
66
+ '-//w3c//dtd html 4.01 transitional//',
67
+ ];
68
+ const QUIRKS_MODE_PUBLIC_IDS = new Set([
69
+ '-//w3o//dtd w3 html strict 3.0//en//',
70
+ '-/w3c/dtd html 4.0 transitional/en',
71
+ 'html',
71
72
  ]);
72
-
73
- const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html'];
74
73
  const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];
75
-
76
- const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([
74
+ const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
75
+ ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,
77
76
  '-//w3c//dtd html 4.01 frameset//',
78
- '-//w3c//dtd html 4.01 transitional//'
79
- ]);
80
-
77
+ '-//w3c//dtd html 4.01 transitional//',
78
+ ];
81
79
  //Utils
82
- function enquoteDoctypeId(id) {
83
- const quote = id.indexOf('"') !== -1 ? "'" : '"';
84
-
85
- return quote + id + quote;
86
- }
87
-
88
80
  function hasPrefix(publicId, prefixes) {
89
- for (let i = 0; i < prefixes.length; i++) {
90
- if (publicId.indexOf(prefixes[i]) === 0) {
91
- return true;
92
- }
93
- }
94
-
95
- return false;
81
+ return prefixes.some((prefix) => publicId.startsWith(prefix));
96
82
  }
97
-
98
83
  //API
99
- exports.isConforming = function(token) {
100
- return (
101
- token.name === VALID_DOCTYPE_NAME &&
84
+ export function isConforming(token) {
85
+ return (token.name === VALID_DOCTYPE_NAME &&
102
86
  token.publicId === null &&
103
- (token.systemId === null || token.systemId === VALID_SYSTEM_ID)
104
- );
105
- };
106
-
107
- exports.getDocumentMode = function(token) {
87
+ (token.systemId === null || token.systemId === VALID_SYSTEM_ID));
88
+ }
89
+ export function getDocumentMode(token) {
108
90
  if (token.name !== VALID_DOCTYPE_NAME) {
109
91
  return DOCUMENT_MODE.QUIRKS;
110
92
  }
111
-
112
- const systemId = token.systemId;
113
-
93
+ const { systemId } = token;
114
94
  if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
115
95
  return DOCUMENT_MODE.QUIRKS;
116
96
  }
117
-
118
- let publicId = token.publicId;
119
-
97
+ let { publicId } = token;
120
98
  if (publicId !== null) {
121
99
  publicId = publicId.toLowerCase();
122
-
123
- if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
100
+ if (QUIRKS_MODE_PUBLIC_IDS.has(publicId)) {
124
101
  return DOCUMENT_MODE.QUIRKS;
125
102
  }
126
-
127
103
  let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
128
-
129
104
  if (hasPrefix(publicId, prefixes)) {
130
105
  return DOCUMENT_MODE.QUIRKS;
131
106
  }
132
-
133
107
  prefixes =
134
108
  systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
135
-
136
109
  if (hasPrefix(publicId, prefixes)) {
137
110
  return DOCUMENT_MODE.LIMITED_QUIRKS;
138
111
  }
139
112
  }
140
-
141
113
  return DOCUMENT_MODE.NO_QUIRKS;
142
- };
143
-
144
- exports.serializeContent = function(name, publicId, systemId) {
145
- let str = '!DOCTYPE ';
146
-
147
- if (name) {
148
- str += name;
149
- }
150
-
151
- if (publicId) {
152
- str += ' PUBLIC ' + enquoteDoctypeId(publicId);
153
- } else if (systemId) {
154
- str += ' SYSTEM';
155
- }
156
-
157
- if (systemId !== null) {
158
- str += ' ' + enquoteDoctypeId(systemId);
159
- }
160
-
161
- return str;
162
- };
114
+ }
@@ -0,0 +1,67 @@
1
+ import type { Location } from './token.js';
2
+ export interface ParserError extends Location {
3
+ code: ERR;
4
+ }
5
+ export type ParserErrorHandler = (error: ParserError) => void;
6
+ export declare enum ERR {
7
+ controlCharacterInInputStream = "control-character-in-input-stream",
8
+ noncharacterInInputStream = "noncharacter-in-input-stream",
9
+ surrogateInInputStream = "surrogate-in-input-stream",
10
+ nonVoidHtmlElementStartTagWithTrailingSolidus = "non-void-html-element-start-tag-with-trailing-solidus",
11
+ endTagWithAttributes = "end-tag-with-attributes",
12
+ endTagWithTrailingSolidus = "end-tag-with-trailing-solidus",
13
+ unexpectedSolidusInTag = "unexpected-solidus-in-tag",
14
+ unexpectedNullCharacter = "unexpected-null-character",
15
+ unexpectedQuestionMarkInsteadOfTagName = "unexpected-question-mark-instead-of-tag-name",
16
+ invalidFirstCharacterOfTagName = "invalid-first-character-of-tag-name",
17
+ unexpectedEqualsSignBeforeAttributeName = "unexpected-equals-sign-before-attribute-name",
18
+ missingEndTagName = "missing-end-tag-name",
19
+ unexpectedCharacterInAttributeName = "unexpected-character-in-attribute-name",
20
+ unknownNamedCharacterReference = "unknown-named-character-reference",
21
+ missingSemicolonAfterCharacterReference = "missing-semicolon-after-character-reference",
22
+ unexpectedCharacterAfterDoctypeSystemIdentifier = "unexpected-character-after-doctype-system-identifier",
23
+ unexpectedCharacterInUnquotedAttributeValue = "unexpected-character-in-unquoted-attribute-value",
24
+ eofBeforeTagName = "eof-before-tag-name",
25
+ eofInTag = "eof-in-tag",
26
+ missingAttributeValue = "missing-attribute-value",
27
+ missingWhitespaceBetweenAttributes = "missing-whitespace-between-attributes",
28
+ missingWhitespaceAfterDoctypePublicKeyword = "missing-whitespace-after-doctype-public-keyword",
29
+ missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers = "missing-whitespace-between-doctype-public-and-system-identifiers",
30
+ missingWhitespaceAfterDoctypeSystemKeyword = "missing-whitespace-after-doctype-system-keyword",
31
+ missingQuoteBeforeDoctypePublicIdentifier = "missing-quote-before-doctype-public-identifier",
32
+ missingQuoteBeforeDoctypeSystemIdentifier = "missing-quote-before-doctype-system-identifier",
33
+ missingDoctypePublicIdentifier = "missing-doctype-public-identifier",
34
+ missingDoctypeSystemIdentifier = "missing-doctype-system-identifier",
35
+ abruptDoctypePublicIdentifier = "abrupt-doctype-public-identifier",
36
+ abruptDoctypeSystemIdentifier = "abrupt-doctype-system-identifier",
37
+ cdataInHtmlContent = "cdata-in-html-content",
38
+ incorrectlyOpenedComment = "incorrectly-opened-comment",
39
+ eofInScriptHtmlCommentLikeText = "eof-in-script-html-comment-like-text",
40
+ eofInDoctype = "eof-in-doctype",
41
+ nestedComment = "nested-comment",
42
+ abruptClosingOfEmptyComment = "abrupt-closing-of-empty-comment",
43
+ eofInComment = "eof-in-comment",
44
+ incorrectlyClosedComment = "incorrectly-closed-comment",
45
+ eofInCdata = "eof-in-cdata",
46
+ absenceOfDigitsInNumericCharacterReference = "absence-of-digits-in-numeric-character-reference",
47
+ nullCharacterReference = "null-character-reference",
48
+ surrogateCharacterReference = "surrogate-character-reference",
49
+ characterReferenceOutsideUnicodeRange = "character-reference-outside-unicode-range",
50
+ controlCharacterReference = "control-character-reference",
51
+ noncharacterCharacterReference = "noncharacter-character-reference",
52
+ missingWhitespaceBeforeDoctypeName = "missing-whitespace-before-doctype-name",
53
+ missingDoctypeName = "missing-doctype-name",
54
+ invalidCharacterSequenceAfterDoctypeName = "invalid-character-sequence-after-doctype-name",
55
+ duplicateAttribute = "duplicate-attribute",
56
+ nonConformingDoctype = "non-conforming-doctype",
57
+ missingDoctype = "missing-doctype",
58
+ misplacedDoctype = "misplaced-doctype",
59
+ endTagWithoutMatchingOpenElement = "end-tag-without-matching-open-element",
60
+ closingOfElementWithOpenChildElements = "closing-of-element-with-open-child-elements",
61
+ disallowedContentInNoscriptInHead = "disallowed-content-in-noscript-in-head",
62
+ openElementsLeftAfterEof = "open-elements-left-after-eof",
63
+ abandonedHeadElementChild = "abandoned-head-element-child",
64
+ misplacedStartTagForHeadElement = "misplaced-start-tag-for-head-element",
65
+ nestedNoscriptInHead = "nested-noscript-in-head",
66
+ eofInElementThatCanContainOnlyText = "eof-in-element-that-can-contain-only-text"
67
+ }
@@ -0,0 +1,63 @@
1
+ export var ERR;
2
+ (function (ERR) {
3
+ ERR["controlCharacterInInputStream"] = "control-character-in-input-stream";
4
+ ERR["noncharacterInInputStream"] = "noncharacter-in-input-stream";
5
+ ERR["surrogateInInputStream"] = "surrogate-in-input-stream";
6
+ ERR["nonVoidHtmlElementStartTagWithTrailingSolidus"] = "non-void-html-element-start-tag-with-trailing-solidus";
7
+ ERR["endTagWithAttributes"] = "end-tag-with-attributes";
8
+ ERR["endTagWithTrailingSolidus"] = "end-tag-with-trailing-solidus";
9
+ ERR["unexpectedSolidusInTag"] = "unexpected-solidus-in-tag";
10
+ ERR["unexpectedNullCharacter"] = "unexpected-null-character";
11
+ ERR["unexpectedQuestionMarkInsteadOfTagName"] = "unexpected-question-mark-instead-of-tag-name";
12
+ ERR["invalidFirstCharacterOfTagName"] = "invalid-first-character-of-tag-name";
13
+ ERR["unexpectedEqualsSignBeforeAttributeName"] = "unexpected-equals-sign-before-attribute-name";
14
+ ERR["missingEndTagName"] = "missing-end-tag-name";
15
+ ERR["unexpectedCharacterInAttributeName"] = "unexpected-character-in-attribute-name";
16
+ ERR["unknownNamedCharacterReference"] = "unknown-named-character-reference";
17
+ ERR["missingSemicolonAfterCharacterReference"] = "missing-semicolon-after-character-reference";
18
+ ERR["unexpectedCharacterAfterDoctypeSystemIdentifier"] = "unexpected-character-after-doctype-system-identifier";
19
+ ERR["unexpectedCharacterInUnquotedAttributeValue"] = "unexpected-character-in-unquoted-attribute-value";
20
+ ERR["eofBeforeTagName"] = "eof-before-tag-name";
21
+ ERR["eofInTag"] = "eof-in-tag";
22
+ ERR["missingAttributeValue"] = "missing-attribute-value";
23
+ ERR["missingWhitespaceBetweenAttributes"] = "missing-whitespace-between-attributes";
24
+ ERR["missingWhitespaceAfterDoctypePublicKeyword"] = "missing-whitespace-after-doctype-public-keyword";
25
+ ERR["missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers"] = "missing-whitespace-between-doctype-public-and-system-identifiers";
26
+ ERR["missingWhitespaceAfterDoctypeSystemKeyword"] = "missing-whitespace-after-doctype-system-keyword";
27
+ ERR["missingQuoteBeforeDoctypePublicIdentifier"] = "missing-quote-before-doctype-public-identifier";
28
+ ERR["missingQuoteBeforeDoctypeSystemIdentifier"] = "missing-quote-before-doctype-system-identifier";
29
+ ERR["missingDoctypePublicIdentifier"] = "missing-doctype-public-identifier";
30
+ ERR["missingDoctypeSystemIdentifier"] = "missing-doctype-system-identifier";
31
+ ERR["abruptDoctypePublicIdentifier"] = "abrupt-doctype-public-identifier";
32
+ ERR["abruptDoctypeSystemIdentifier"] = "abrupt-doctype-system-identifier";
33
+ ERR["cdataInHtmlContent"] = "cdata-in-html-content";
34
+ ERR["incorrectlyOpenedComment"] = "incorrectly-opened-comment";
35
+ ERR["eofInScriptHtmlCommentLikeText"] = "eof-in-script-html-comment-like-text";
36
+ ERR["eofInDoctype"] = "eof-in-doctype";
37
+ ERR["nestedComment"] = "nested-comment";
38
+ ERR["abruptClosingOfEmptyComment"] = "abrupt-closing-of-empty-comment";
39
+ ERR["eofInComment"] = "eof-in-comment";
40
+ ERR["incorrectlyClosedComment"] = "incorrectly-closed-comment";
41
+ ERR["eofInCdata"] = "eof-in-cdata";
42
+ ERR["absenceOfDigitsInNumericCharacterReference"] = "absence-of-digits-in-numeric-character-reference";
43
+ ERR["nullCharacterReference"] = "null-character-reference";
44
+ ERR["surrogateCharacterReference"] = "surrogate-character-reference";
45
+ ERR["characterReferenceOutsideUnicodeRange"] = "character-reference-outside-unicode-range";
46
+ ERR["controlCharacterReference"] = "control-character-reference";
47
+ ERR["noncharacterCharacterReference"] = "noncharacter-character-reference";
48
+ ERR["missingWhitespaceBeforeDoctypeName"] = "missing-whitespace-before-doctype-name";
49
+ ERR["missingDoctypeName"] = "missing-doctype-name";
50
+ ERR["invalidCharacterSequenceAfterDoctypeName"] = "invalid-character-sequence-after-doctype-name";
51
+ ERR["duplicateAttribute"] = "duplicate-attribute";
52
+ ERR["nonConformingDoctype"] = "non-conforming-doctype";
53
+ ERR["missingDoctype"] = "missing-doctype";
54
+ ERR["misplacedDoctype"] = "misplaced-doctype";
55
+ ERR["endTagWithoutMatchingOpenElement"] = "end-tag-without-matching-open-element";
56
+ ERR["closingOfElementWithOpenChildElements"] = "closing-of-element-with-open-child-elements";
57
+ ERR["disallowedContentInNoscriptInHead"] = "disallowed-content-in-noscript-in-head";
58
+ ERR["openElementsLeftAfterEof"] = "open-elements-left-after-eof";
59
+ ERR["abandonedHeadElementChild"] = "abandoned-head-element-child";
60
+ ERR["misplacedStartTagForHeadElement"] = "misplaced-start-tag-for-head-element";
61
+ ERR["nestedNoscriptInHead"] = "nested-noscript-in-head";
62
+ ERR["eofInElementThatCanContainOnlyText"] = "eof-in-element-that-can-contain-only-text";
63
+ })(ERR || (ERR = {}));
@@ -0,0 +1,9 @@
1
+ import { TAG_ID as $, NS } from './html.js';
2
+ import type { TagToken, Attribute } from './token.js';
3
+ export declare const SVG_TAG_NAMES_ADJUSTMENT_MAP: Map<string, string>;
4
+ export declare function causesExit(startTagToken: TagToken): boolean;
5
+ export declare function adjustTokenMathMLAttrs(token: TagToken): void;
6
+ export declare function adjustTokenSVGAttrs(token: TagToken): void;
7
+ export declare function adjustTokenXMLAttrs(token: TagToken): void;
8
+ export declare function adjustTokenSVGTagName(token: TagToken): void;
9
+ export declare function isIntegrationPoint(tn: $, ns: NS, attrs: Attribute[], foreignNS?: NS): boolean;