Skip to content

Commit a68c520

Browse files
authored
Merge pull request #1 from diervo/dval/tagNameErrors
Adding parse errors for tag name state
2 parents 12c75fa + 86ccbfa commit a68c520

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/common/error_codes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
startOfProcessingInstructionOrXMLDeclaration: 'start-of-processing-instruction-or-xml-declaration',
1111
unexpectedFirstCharacterOfStartTagName: 'unexpected-first-character-of-start-tag-name',
1212
missingEndTagName: 'missing-end-tag-name',
13+
eofInTagName: 'eof-in-tag-name',
1314
eofBeforeEndTagName: 'eof-before-end-tag-name',
1415
cdataInHtmlContent: 'cdata-in-html-content',
1516
malformedComment: 'malformed-comment',

lib/tokenizer/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,11 +748,15 @@ _[TAG_NAME_STATE] = function tagNameState(cp) {
748748
else if (isAsciiUpper(cp))
749749
this.currentToken.tagName += toAsciiLowerChar(cp);
750750

751-
else if (cp === $.NULL)
751+
else if (cp === $.NULL) {
752+
this._err(ERR.unexpectedNullCharacter);
752753
this.currentToken.tagName += UNICODE.REPLACEMENT_CHARACTER;
754+
}
753755

754-
else if (cp === $.EOF)
756+
else if (cp === $.EOF) {
757+
this._err(ERR.eofInTagName);
755758
this._emitEOFToken();
759+
}
756760

757761
else
758762
this.currentToken.tagName += toChar(cp);

0 commit comments

Comments
 (0)