Skip to content

Commit

Permalink
Merge pull request #23 from HTMLParseErrorWG/review-fixes2
Browse files Browse the repository at this point in the history
Add error for duplicate attribute
  • Loading branch information
inikulin authored May 30, 2017
2 parents 13a204c + f6054be commit 8eb950a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/common/error_codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ module.exports = {
undefinedCharacterReference: 'undefined-character-reference',
missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name',
missingDoctypeName: 'missing-doctype-name',
invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name'
invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name',
duplicateAttribute: 'duplicate-attribute'
};
3 changes: 3 additions & 0 deletions lib/tokenizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ Tokenizer.prototype._leaveAttrName = function (toState) {
if (Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) === null)
this.currentToken.attrs.push(this.currentAttr);

else
this._err(ERR.duplicateAttribute);

this.state = toState;
};

Expand Down

0 comments on commit 8eb950a

Please sign in to comment.