Skip to content

Commit

Permalink
Add error for duplicate attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
inikulin committed Apr 16, 2018
1 parent a1937e4 commit 225d27f
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 225d27f

Please sign in to comment.