Skip to content

Commit f84be6a

Browse files
authored
Merge pull request #31 from HTMLParseErrorWG/more-modes
Fix EOF position calculation. Add text insertion mode parse errors
2 parents db23e29 + 39986cb commit f84be6a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/common/error_codes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ module.exports = {
5959
openElementsLeftAfterEof: 'open-elements-left-after-eof',
6060
abandonedHeadElementChild: 'abandoned-head-element-child',
6161
misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element',
62-
nestedNoscriptInHead: 'nested-noscript-in-head'
62+
nestedNoscriptInHead: 'nested-noscript-in-head',
63+
eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text'
6364
};

lib/extensions/location_info/tokenizer_mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ LocationInfoTokenizerMixin.prototype._getOverriddenMethods = function (mxn, orig
7070

7171
_createEOFToken: function () {
7272
orig._createEOFToken.call(this);
73-
this.currentToken.location = mxn.ctLoc;
73+
this.currentToken.location = mxn._getCurrentLocation();
7474
},
7575

7676
_createAttr: function (attrNameFirstCh) {

lib/parser/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,7 @@ function endTagInText(p, token) {
21662166

21672167

21682168
function eofInText(p, token) {
2169+
p._err(ERR.eofInElementThatCanContainOnlyText);
21692170
p.openElements.pop();
21702171
p.insertionMode = p.originalInsertionMode;
21712172
p._processToken(token);

0 commit comments

Comments
 (0)