fix(compiler-core): do not increase newlines in `InEntity` state (#13362)
This commit is contained in:
parent
762fae4b57
commit
f05a8d613b
|
@ -2271,6 +2271,11 @@ describe('compiler: parse', () => {
|
||||||
expect(span.loc.start.offset).toBe(0)
|
expect(span.loc.start.offset).toBe(0)
|
||||||
expect(span.loc.end.offset).toBe(27)
|
expect(span.loc.end.offset).toBe(27)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('correct loc when a line in attribute value ends with &', () => {
|
||||||
|
const [span] = baseParse(`<span v-if="foo &&\nbar"></span>`).children
|
||||||
|
expect(span.loc.end.line).toBe(2)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('decodeEntities option', () => {
|
describe('decodeEntities option', () => {
|
||||||
|
|
|
@ -929,7 +929,7 @@ export default class Tokenizer {
|
||||||
this.buffer = input
|
this.buffer = input
|
||||||
while (this.index < this.buffer.length) {
|
while (this.index < this.buffer.length) {
|
||||||
const c = this.buffer.charCodeAt(this.index)
|
const c = this.buffer.charCodeAt(this.index)
|
||||||
if (c === CharCodes.NewLine) {
|
if (c === CharCodes.NewLine && this.state !== State.InEntity) {
|
||||||
this.newlines.push(this.index)
|
this.newlines.push(this.index)
|
||||||
}
|
}
|
||||||
switch (this.state) {
|
switch (this.state) {
|
||||||
|
|
Loading…
Reference in New Issue