2021-05-23 12:14:02 +02:00
|
|
|
@name Invalid Shadow DOM selector
|
|
|
|
|
@category compiler
|
|
|
|
|
@shortDescription Component selector does not match shadow DOM requirements
|
|
|
|
|
|
|
|
|
|
@description
|
2022-03-10 08:48:09 -08:00
|
|
|
|
2021-05-23 12:14:02 +02:00
|
|
|
The selector of a component using `ViewEncapsulation.ShadowDom` doesn't match the custom element tag name requirements.
|
|
|
|
|
|
|
|
|
|
In order for a tag name to be considered a valid custom element name, it has to:
|
2022-03-10 08:48:09 -08:00
|
|
|
|
|
|
|
|
* Be in lower case.
|
|
|
|
|
* Contain a hyphen.
|
|
|
|
|
* Start with a letter \(a-z\).
|
2021-05-23 12:14:02 +02:00
|
|
|
|
|
|
|
|
@debugging
|
|
|
|
|
Rename your component's selector so that it matches the requirements.
|
|
|
|
|
|
|
|
|
|
**Before:**
|
2022-03-10 08:48:09 -08:00
|
|
|
|
|
|
|
|
<code-example format="typescript" language="typescript">
|
|
|
|
|
|
|
|
|
|
@Component({
|
2021-05-23 12:14:02 +02:00
|
|
|
selector: 'comp',
|
|
|
|
|
encapsulation: ViewEncapsulation.ShadowDom
|
2022-03-10 08:48:09 -08:00
|
|
|
…
|
2021-05-23 12:14:02 +02:00
|
|
|
})
|
2022-03-10 08:48:09 -08:00
|
|
|
|
|
|
|
|
</code-example>
|
2021-05-23 12:14:02 +02:00
|
|
|
|
|
|
|
|
**After:**
|
2022-03-10 08:48:09 -08:00
|
|
|
|
|
|
|
|
<code-example format="typescript" language="typescript">
|
|
|
|
|
|
|
|
|
|
@Component({
|
2021-05-23 12:14:02 +02:00
|
|
|
selector: 'app-comp',
|
|
|
|
|
encapsulation: ViewEncapsulation.ShadowDom
|
2022-03-10 08:48:09 -08:00
|
|
|
…
|
2021-05-23 12:14:02 +02:00
|
|
|
})
|
2022-03-10 08:48:09 -08:00
|
|
|
|
|
|
|
|
</code-example>
|