/**
* @typedef ErrorInfo
* Info on a `parse5` error.
* @property {string} reason
* Reason of error.
* @property {string} description
* More info on error.
* @property {false} [url]
* Turn off if this is not documented in the html5 spec (optional).
*/
export const errors = {
/** @type {ErrorInfo} */
abandonedHeadElementChild: {
reason: 'Unexpected metadata element after head',
description:
'Unexpected element after head. Expected the element before ``',
url: false
},
/** @type {ErrorInfo} */
abruptClosingOfEmptyComment: {
reason: 'Unexpected abruptly closed empty comment',
description: 'Unexpected `>` or `->`. Expected `-->` to close comments'
},
/** @type {ErrorInfo} */
abruptDoctypePublicIdentifier: {
reason: 'Unexpected abruptly closed public identifier',
description:
'Unexpected `>`. Expected a closing `"` or `\'` after the public identifier'
},
/** @type {ErrorInfo} */
abruptDoctypeSystemIdentifier: {
reason: 'Unexpected abruptly closed system identifier',
description:
'Unexpected `>`. Expected a closing `"` or `\'` after the identifier identifier'
},
/** @type {ErrorInfo} */
absenceOfDigitsInNumericCharacterReference: {
reason: 'Unexpected non-digit at start of numeric character reference',
description:
'Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references'
},
/** @type {ErrorInfo} */
cdataInHtmlContent: {
reason: 'Unexpected CDATA section in HTML',
description:
'Unexpected `` in `
`',
description:
'Unexpected text character `%c`. Only use text in ``s in ``',
url: false
},
/** @type {ErrorInfo} */
duplicateAttribute: {
reason: 'Unexpected duplicate attribute',
description:
'Unexpectedly double attribute. Expected attributes to occur only once'
},
/** @type {ErrorInfo} */
endTagWithAttributes: {
reason: 'Unexpected attribute on closing tag',
description: 'Unexpected attribute. Expected `>` instead'
},
/** @type {ErrorInfo} */
endTagWithTrailingSolidus: {
reason: 'Unexpected slash at end of closing tag',
description: 'Unexpected `%c-1`. Expected `>` instead'
},
/** @type {ErrorInfo} */
endTagWithoutMatchingOpenElement: {
reason: 'Unexpected unopened end tag',
description: 'Unexpected end tag. Expected no end tag or another end tag',
url: false
},
/** @type {ErrorInfo} */
eofBeforeTagName: {
reason: 'Unexpected end of file',
description: 'Unexpected end of file. Expected tag name instead'
},
/** @type {ErrorInfo} */
eofInCdata: {
reason: 'Unexpected end of file in CDATA',
description: 'Unexpected end of file. Expected `]]>` to close the CDATA'
},
/** @type {ErrorInfo} */
eofInComment: {
reason: 'Unexpected end of file in comment',
description: 'Unexpected end of file. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
eofInDoctype: {
reason: 'Unexpected end of file in doctype',
description:
'Unexpected end of file. Expected a valid doctype (such as ``)'
},
/** @type {ErrorInfo} */
eofInElementThatCanContainOnlyText: {
reason: 'Unexpected end of file in element that can only contain text',
description: 'Unexpected end of file. Expected text or a closing tag',
url: false
},
/** @type {ErrorInfo} */
eofInScriptHtmlCommentLikeText: {
reason: 'Unexpected end of file in comment inside script',
description: 'Unexpected end of file. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
eofInTag: {
reason: 'Unexpected end of file in tag',
description: 'Unexpected end of file. Expected `>` to close the tag'
},
/** @type {ErrorInfo} */
incorrectlyClosedComment: {
reason: 'Incorrectly closed comment',
description: 'Unexpected `%c-1`. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
incorrectlyOpenedComment: {
reason: 'Incorrectly opened comment',
description: 'Unexpected `%c`. Expected ``'
},
/** @type {ErrorInfo} */
nestedNoscriptInHead: {
reason: 'Unexpected nested `` in ``',
description:
'Unexpected ``. Expected a closing tag or a meta element',
url: false
},
/** @type {ErrorInfo} */
nonConformingDoctype: {
reason: 'Unexpected non-conforming doctype declaration',
description:
'Expected `` or ``',
url: false
},
/** @type {ErrorInfo} */
nonVoidHtmlElementStartTagWithTrailingSolidus: {
reason: 'Unexpected trailing slash on start tag of non-void element',
description: 'Unexpected `/`. Expected `>` instead'
},
/** @type {ErrorInfo} */
noncharacterCharacterReference: {
reason:
'Unexpected noncharacter code point referenced by character reference',
description: 'Unexpected code point. Do not use noncharacters in HTML'
},
/** @type {ErrorInfo} */
noncharacterInInputStream: {
reason: 'Unexpected noncharacter character',
description: 'Unexpected code point `%x`. Do not use noncharacters in HTML'
},
/** @type {ErrorInfo} */
nullCharacterReference: {
reason: 'Unexpected NULL character referenced by character reference',
description: 'Unexpected code point. Do not use NULL characters in HTML'
},
/** @type {ErrorInfo} */
openElementsLeftAfterEof: {
reason: 'Unexpected end of file',
description: 'Unexpected end of file. Expected closing tag instead',
url: false
},
/** @type {ErrorInfo} */
surrogateCharacterReference: {
reason: 'Unexpected surrogate character referenced by character reference',
description:
'Unexpected code point. Do not use lone surrogate characters in HTML'
},
/** @type {ErrorInfo} */
surrogateInInputStream: {
reason: 'Unexpected surrogate character',
description:
'Unexpected code point `%x`. Do not use lone surrogate characters in HTML'
},
/** @type {ErrorInfo} */
unexpectedCharacterAfterDoctypeSystemIdentifier: {
reason: 'Invalid character after system identifier in doctype',
description: 'Unexpected character at `%c`. Expected `>`'
},
/** @type {ErrorInfo} */
unexpectedCharacterInAttributeName: {
reason: 'Unexpected character in attribute name',
description:
'Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter'
},
/** @type {ErrorInfo} */
unexpectedCharacterInUnquotedAttributeValue: {
reason: 'Unexpected character in unquoted attribute value',
description: 'Unexpected `%c`. Quote the attribute value to include it'
},
/** @type {ErrorInfo} */
unexpectedEqualsSignBeforeAttributeName: {
reason: 'Unexpected equals sign before attribute name',
description: 'Unexpected `%c`. Add an attribute name before it'
},
/** @type {ErrorInfo} */
unexpectedNullCharacter: {
reason: 'Unexpected NULL character',
description:
'Unexpected code point `%x`. Do not use NULL characters in HTML'
},
/** @type {ErrorInfo} */
unexpectedQuestionMarkInsteadOfTagName: {
reason: 'Unexpected question mark instead of tag name',
description: 'Unexpected `%c`. Expected an ASCII letter instead'
},
/** @type {ErrorInfo} */
unexpectedSolidusInTag: {
reason: 'Unexpected slash in tag',
description:
'Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value'
},
/** @type {ErrorInfo} */
unknownNamedCharacterReference: {
reason: 'Unexpected unknown named character reference',
description:
'Unexpected character reference. Expected known named character references'
}
}