Skip to content

Commit fcbeae4

Browse files
committed
Add unexpected-null-character' error.
1 parent cfc7b4c commit fcbeae4

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.vscode
23
node_modules
34
docs/build
45
docs/05_api_reference.md

lib/common/error_codes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ module.exports = {
55
nonUnicodeCharacterInInputStream: 'non-unicode-character-in-input-stream',
66
selfClosingNonVoidHtmlElement: 'self-closing-non-void-html-element',
77
endTagWithAttributes: 'end-tag-with-attributes',
8-
selfClosingEndTag: 'self-closing-end-tag'
8+
selfClosingEndTag: 'self-closing-end-tag',
9+
unexpectedNullCharacter: 'unexpected-null-character'
910
};

lib/tokenizer/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,10 @@ _[DATA_STATE] = function dataState(cp) {
644644
else if (cp === $.LESS_THAN_SIGN)
645645
this.state = TAG_OPEN_STATE;
646646

647-
else if (cp === $.NULL)
647+
else if (cp === $.NULL) {
648+
this._err(ERR.unexpectedNullCharacter, null);
648649
this._emitCodePoint(cp);
650+
}
649651

650652
else if (cp === $.EOF)
651653
this._emitEOFToken();

0 commit comments

Comments
 (0)