-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compiler): allow self-closing tags on custom elements (#48535)
Allows for self-closing tags to be used for non-native tag names, e.g. `<foo [input]="bar"></foo>` can now be written as `<foo [input]="bar"/>`. Native tag names still have to have closing tags. Fixes #39525. PR Close #48535
- Loading branch information
Showing
12 changed files
with
244 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...es/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/self_closing_tags.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {Component, NgModule} from '@angular/core'; | ||
|
||
@Component({selector: 'my-comp', template: 'hello'}) | ||
export class MyComp { | ||
} | ||
|
||
@Component({template: `<my-comp/>`}) | ||
export class App { | ||
} | ||
|
||
@NgModule({declarations: [App, MyComp]}) | ||
export class MyModule { | ||
} |
17 changes: 17 additions & 0 deletions
17
...iler-cli/test/compliance/test_cases/r3_view_compiler_template/self_closing_tags_nested.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Component, NgModule} from '@angular/core'; | ||
|
||
@Component({selector: 'my-comp', template: 'hello'}) | ||
export class MyComp { | ||
} | ||
|
||
@Component({ | ||
template: ` | ||
<my-comp title="a">Before<my-comp title="b"></my-comp>After</my-comp> | ||
` | ||
}) | ||
export class App { | ||
} | ||
|
||
@NgModule({declarations: [App, MyComp]}) | ||
export class MyModule { | ||
} |
11 changes: 11 additions & 0 deletions
11
...test/compliance/test_cases/r3_view_compiler_template/self_closing_tags_nested_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
template: function App_Template(rf, ctx) { | ||
if (rf & 1) { | ||
… | ||
i0.ɵɵelementStart(0, "my-comp", 0); | ||
i0.ɵɵtext(1, "Before"); | ||
i0.ɵɵelement(2, "my-comp", 1); | ||
i0.ɵɵtext(3, "After"); | ||
i0.ɵɵelementEnd(); | ||
… | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...er-cli/test/compliance/test_cases/r3_view_compiler_template/self_closing_tags_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
template: function App_Template(rf, ctx) { | ||
if (rf & 1) { | ||
… | ||
i0.ɵɵelement(0, "my-comp"); | ||
… | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.