fix(compiler): markup lexer should not capture quotes in attribute value (#28055)
When tokenizing markup (e.g. HTML) element attributes can have quoted or unquoted values (e.g. `a=b` or `a="b"`). The `ATTR_VALUE` tokens were capturing the quotes, which was inconsistent and also affected source-mapping. Now the tokenizer captures additional `ATTR_QUOTE` tokens, which the HTML related parsers understand and factor into their token parsing. PR Close #28055
This commit is contained in:

committed by
Misko Hevery

parent
e6a00be014
commit
c0dac184cd
@ -316,7 +316,7 @@ class ExpressionVisitor extends NullTemplateVisitor {
|
||||
|
||||
// find the template binding that contains the position
|
||||
if (!this.attr.valueSpan) return;
|
||||
const valueRelativePosition = this.position - this.attr.valueSpan.start.offset - 1;
|
||||
const valueRelativePosition = this.position - this.attr.valueSpan.start.offset;
|
||||
const bindings = templateBindingResult.templateBindings;
|
||||
const binding =
|
||||
bindings.find(
|
||||
@ -401,7 +401,7 @@ class ExpressionVisitor extends NullTemplateVisitor {
|
||||
|
||||
private get attributeValuePosition() {
|
||||
if (this.attr && this.attr.valueSpan) {
|
||||
return this.position - this.attr.valueSpan.start.offset - 1;
|
||||
return this.position - this.attr.valueSpan.start.offset;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user