Skip to content

Commit b92eff0

Browse files
committed
chore: update
1 parent dc8f255 commit b92eff0

File tree

2 files changed

+65
-55
lines changed

2 files changed

+65
-55
lines changed

packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,39 +2467,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
24672467
},
24682468
},
24692469
"ns": 0,
2470-
"props": [
2471-
{
2472-
"loc": {
2473-
"end": {
2474-
"column": 17,
2475-
"line": 1,
2476-
"offset": 16,
2477-
},
2478-
"source": """,
2479-
"start": {
2480-
"column": 16,
2481-
"line": 1,
2482-
"offset": 15,
2483-
},
2484-
},
2485-
"name": """,
2486-
"nameLoc": {
2487-
"end": {
2488-
"column": 17,
2489-
"line": 1,
2490-
"offset": 16,
2491-
},
2492-
"source": """,
2493-
"start": {
2494-
"column": 16,
2495-
"line": 1,
2496-
"offset": 15,
2497-
},
2498-
},
2499-
"type": 6,
2500-
"value": undefined,
2501-
},
2502-
],
2470+
"props": [],
25032471
"tag": "div",
25042472
"tagType": 0,
25052473
"type": 1,
@@ -2978,29 +2946,29 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
29782946
{
29792947
"loc": {
29802948
"end": {
2981-
"column": 21,
2949+
"column": 19,
29822950
"line": 1,
2983-
"offset": 20,
2951+
"offset": 18,
29842952
},
2985-
"source": """,
2953+
"source": "foo",
29862954
"start": {
2987-
"column": 20,
2955+
"column": 16,
29882956
"line": 1,
2989-
"offset": 19,
2957+
"offset": 15,
29902958
},
29912959
},
2992-
"name": """,
2960+
"name": "foo",
29932961
"nameLoc": {
29942962
"end": {
2995-
"column": 21,
2963+
"column": 19,
29962964
"line": 1,
2997-
"offset": 20,
2965+
"offset": 18,
29982966
},
2999-
"source": """,
2967+
"source": "foo",
30002968
"start": {
3001-
"column": 20,
2969+
"column": 16,
30022970
"line": 1,
3003-
"offset": 19,
2971+
"offset": 15,
30042972
},
30052973
},
30062974
"type": 6,
@@ -3696,7 +3664,39 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
36963664
},
36973665
},
36983666
"ns": 0,
3699-
"props": [],
3667+
"props": [
3668+
{
3669+
"loc": {
3670+
"end": {
3671+
"column": 17,
3672+
"line": 1,
3673+
"offset": 16,
3674+
},
3675+
"source": "=",
3676+
"start": {
3677+
"column": 16,
3678+
"line": 1,
3679+
"offset": 15,
3680+
},
3681+
},
3682+
"name": "=",
3683+
"nameLoc": {
3684+
"end": {
3685+
"column": 17,
3686+
"line": 1,
3687+
"offset": 16,
3688+
},
3689+
"source": "=",
3690+
"start": {
3691+
"column": 16,
3692+
"line": 1,
3693+
"offset": 15,
3694+
},
3695+
},
3696+
"type": 6,
3697+
"value": undefined,
3698+
},
3699+
],
37003700
"tag": "div",
37013701
"tagType": 0,
37023702
"type": 1,
@@ -3779,25 +3779,25 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
37793779
"line": 1,
37803780
"offset": 23,
37813781
},
3782-
"source": "foo=bar",
3782+
"source": "=foo=bar",
37833783
"start": {
3784-
"column": 17,
3784+
"column": 16,
37853785
"line": 1,
3786-
"offset": 16,
3786+
"offset": 15,
37873787
},
37883788
},
3789-
"name": "foo",
3789+
"name": "=foo",
37903790
"nameLoc": {
37913791
"end": {
37923792
"column": 20,
37933793
"line": 1,
37943794
"offset": 19,
37953795
},
3796-
"source": "foo",
3796+
"source": "=foo",
37973797
"start": {
3798-
"column": 17,
3798+
"column": 16,
37993799
"line": 1,
3800-
"offset": 16,
3800+
"offset": 15,
38013801
},
38023802
},
38033803
"type": 6,

packages/compiler-core/src/tokenizer.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,24 @@ export default class Tokenizer {
651651
this.state = State.BeforeTagName
652652
this.sectionStart = this.index
653653
} else if (!isWhitespace(c)) {
654+
if ((__DEV__ || !__BROWSER__) && c === CharCodes.Eq) {
655+
this.cbs.onerr(
656+
ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
657+
this.index,
658+
)
659+
}
654660
this.handleAttrStart(c)
655661
}
656662
}
657663
private handleAttrStart(c: number) {
658-
if ((__DEV__ || !__BROWSER__) && c === CharCodes.Eq) {
664+
if (
665+
(__DEV__ || !__BROWSER__) &&
666+
(c === CharCodes.DoubleQuote ||
667+
c === CharCodes.SingleQuote ||
668+
c === CharCodes.Lt)
669+
) {
659670
this.cbs.onerr(
660-
ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
671+
ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
661672
this.index,
662673
)
663674
} else if (c === CharCodes.LowerV && this.peek() === CharCodes.Dash) {
@@ -675,7 +686,6 @@ export default class Tokenizer {
675686
} else {
676687
this.state = State.InAttrName
677688
this.sectionStart = this.index
678-
this.stateInAttrName(c)
679689
}
680690
}
681691
private stateInSelfClosingTag(c: number): void {

0 commit comments

Comments
 (0)