diff --git a/lib/common/error_codes.js b/lib/common/error_codes.js index da156daf1..1459fd940 100644 --- a/lib/common/error_codes.js +++ b/lib/common/error_codes.js @@ -10,6 +10,7 @@ module.exports = { startOfProcessingInstructionOrXMLDeclaration: 'start-of-processing-instruction-or-xml-declaration', unexpectedFirstCharacterOfStartTagName: 'unexpected-first-character-of-start-tag-name', missingEndTagName: 'missing-end-tag-name', + eofInTagName: 'eof-in-tag-name', eofBeforeEndTagName: 'eof-before-end-tag-name', cdataInHtmlContent: 'cdata-in-html-content', malformedComment: 'malformed-comment', diff --git a/lib/tokenizer/index.js b/lib/tokenizer/index.js index e67612e9a..00660674a 100644 --- a/lib/tokenizer/index.js +++ b/lib/tokenizer/index.js @@ -748,11 +748,15 @@ _[TAG_NAME_STATE] = function tagNameState(cp) { else if (isAsciiUpper(cp)) this.currentToken.tagName += toAsciiLowerChar(cp); - else if (cp === $.NULL) + else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); this.currentToken.tagName += UNICODE.REPLACEMENT_CHARACTER; + } - else if (cp === $.EOF) + else if (cp === $.EOF) { + this._err(ERR.eofInTagName); this._emitEOFToken(); + } else this.currentToken.tagName += toChar(cp);