Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f05a8d6

Browse filesBrowse files
authored
fix(compiler-core): do not increase newlines in InEntity state (#13362)
1 parent 762fae4 commit f05a8d6
Copy full SHA for f05a8d6

File tree

Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed

‎packages/compiler-core/__tests__/parse.spec.ts

Copy file name to clipboardExpand all lines: packages/compiler-core/__tests__/parse.spec.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,11 @@ describe('compiler: parse', () => {
22712271
expect(span.loc.start.offset).toBe(0)
22722272
expect(span.loc.end.offset).toBe(27)
22732273
})
2274+
2275+
test('correct loc when a line in attribute value ends with &', () => {
2276+
const [span] = baseParse(`<span v-if="foo &&\nbar"></span>`).children
2277+
expect(span.loc.end.line).toBe(2)
2278+
})
22742279
})
22752280

22762281
describe('decodeEntities option', () => {

‎packages/compiler-core/src/tokenizer.ts

Copy file name to clipboardExpand all lines: packages/compiler-core/src/tokenizer.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ export default class Tokenizer {
929929
this.buffer = input
930930
while (this.index < this.buffer.length) {
931931
const c = this.buffer.charCodeAt(this.index)
932-
if (c === CharCodes.NewLine) {
932+
if (c === CharCodes.NewLine && this.state !== State.InEntity) {
933933
this.newlines.push(this.index)
934934
}
935935
switch (this.state) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.