})
})
+ // #13361
+ test('directive with multiline value', () => {
+ const ast = baseParse(
+ `<div v-if="
+ foo &&
+ bar
+ "></div>`,
+ )
+ expect(ast.loc.end.line).toBe(4)
+ })
+
test('directive with argument', () => {
const ast = baseParse('<div v-on:click/>')
const directive = (ast.children[0] as ElementNode).props[0]
}
this.state = State.BeforeTagName
this.sectionStart = this.index
- } else if (!__BROWSER__ && c === CharCodes.Amp) {
+ } else if (!__BROWSER__ && c === CharCodes.Amp && !this.isLogicalAnd()) {
this.startEntity()
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
this.state = State.InterpolationOpen
(this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot)
) {
// We have to parse entities in <title> and <textarea> tags.
- if (!__BROWSER__ && c === CharCodes.Amp) {
+ if (!__BROWSER__ && c === CharCodes.Amp && !this.isLogicalAnd()) {
this.startEntity()
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
// We also need to handle interpolation
this.index + 1,
)
this.state = State.BeforeAttrName
- } else if (!__BROWSER__ && c === CharCodes.Amp) {
+ } else if (!__BROWSER__ && c === CharCodes.Amp && !this.isLogicalAnd()) {
this.startEntity()
}
}
ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
this.index,
)
- } else if (!__BROWSER__ && c === CharCodes.Amp) {
+ } else if (!__BROWSER__ && c === CharCodes.Amp && !this.isLogicalAnd()) {
this.startEntity()
}
}
}
}
}
+
+ private isLogicalAnd(): boolean {
+ return (
+ this.buffer.charCodeAt(this.index - 1) === CharCodes.Amp ||
+ this.buffer.charCodeAt(this.index + 1) === CharCodes.Amp
+ )
+ }
}