Skip to content

Commit

Permalink
lexer: validate the lexed attribute names
Browse files Browse the repository at this point in the history
Check that the lexed attribute names are valid HTML attributes.
Valid attribute names include things like '(click)'.
  • Loading branch information
matheusmoreira committed Aug 26, 2023
1 parent 31d510a commit 821d836
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/pugneum-lexer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,14 @@ Lexer.prototype = {
}
}

let invalid = key.replaceAll(attributeName, '');
if (invalid.length !== 0) {
this.error(
'INVALID_ATTRIBUTE_NAME',
'Code points not allowed in HTML attribute names: ' + invalid
);
}

tok.name = key;

var valueResponse = this.attributeValue(str.substr(i));
Expand Down

0 comments on commit 821d836

Please sign in to comment.