refactor(compiler): element.sourceSpan
should span the outerHTML
(#38581)
Previously, the `sourceSpan` and `startSourceSpan` were the same object, which meant that you had the following situation: ``` element = <div>some content</div> sourceSpan = <div> startSourceSpan = <div> endSourceSpan = </div> ``` This made `sourceSpan` redundant and meant that if you wanted a span for the whole element including its content and closing tag, it had to be computed. Now `sourceSpan` is separated from `startSourceSpan` resulting in: ``` element = <div>some content</div> sourceSpan = <div>some content</div> startSourceSpan = <div> endSourceSpan = </div> ``` PR Close #38581
This commit is contained in:

committed by
Andrew Scott

parent
a68f1a78a7
commit
1d8c5d88cd
@ -42,7 +42,7 @@ const EXPECTED_XMB = `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<msg id="5811701742971715242" desc="with ICU and other things"><source>src/icu.html:4,6</source>
|
||||
foo <ph name="ICU"><ex>{ count, plural, =1 {...} other {...}}</ex>{ count, plural, =1 {...} other {...}}</ph>
|
||||
</msg>
|
||||
<msg id="7254052530614200029" desc="with placeholders"><source>src/placeholders.html:1</source>Name: <ph name="START_BOLD_TEXT"><ex><b></ex><b></ph><ph name="NAME"><ex>{{
|
||||
<msg id="7254052530614200029" desc="with placeholders"><source>src/placeholders.html:1,3</source>Name: <ph name="START_BOLD_TEXT"><ex><b></ex><b></ph><ph name="NAME"><ex>{{
|
||||
name // i18n(ph="name")
|
||||
}}</ex>{{
|
||||
name // i18n(ph="name")
|
||||
@ -182,7 +182,7 @@ const EXPECTED_XLIFF2 = `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<unit id="7254052530614200029">
|
||||
<notes>
|
||||
<note category="description">with placeholders</note>
|
||||
<note category="location">src/placeholders.html:1</note>
|
||||
<note category="location">src/placeholders.html:1,3</note>
|
||||
</notes>
|
||||
<segment>
|
||||
<source>Name: <pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>"><ph id="1" equiv="NAME" disp="{{
|
||||
|
@ -342,7 +342,7 @@ runInEachFileSystem((os) => {
|
||||
expect(mappings).toContain(
|
||||
{source: '<h3>', generated: 'i0.ɵɵelementStart(0, "h3")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: '<ng-content select="title">',
|
||||
source: '<ng-content select="title"></ng-content>',
|
||||
generated: 'i0.ɵɵprojection(1)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
@ -351,7 +351,7 @@ runInEachFileSystem((os) => {
|
||||
expect(mappings).toContain(
|
||||
{source: '<div>', generated: 'i0.ɵɵelementStart(2, "div")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: '<ng-content>',
|
||||
source: '<ng-content></ng-content>',
|
||||
generated: 'i0.ɵɵprojection(3, 1)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
|
Reference in New Issue
Block a user