Skip to content

Commit 11da12b

Browse files
committed
fix(compiler-core): handle unexpected characters in attribute names
1 parent b555f02 commit 11da12b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/compiler-core/src/tokenizer.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,17 @@ export default class Tokenizer {
661661
}
662662
}
663663
private handleAttrStart(c: number) {
664-
if (c === CharCodes.LowerV && this.peek() === CharCodes.Dash) {
664+
if (
665+
(__DEV__ || !__BROWSER__) &&
666+
(c === CharCodes.DoubleQuote ||
667+
c === CharCodes.SingleQuote ||
668+
c === CharCodes.Lt)
669+
) {
670+
this.cbs.onerr(
671+
ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
672+
this.index,
673+
)
674+
} else if (c === CharCodes.LowerV && this.peek() === CharCodes.Dash) {
665675
this.state = State.InDirName
666676
this.sectionStart = this.index
667677
} else if (

0 commit comments

Comments
 (0)