fix(core): fix specificity ScopedStylesController
This commit is contained in:
parent
d0bcfc08e7
commit
1b5878678b
1 changed files with 5 additions and 1 deletions
|
|
@ -35,10 +35,14 @@ export class ScopedStylesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
__setupStyleTag() {
|
__setupStyleTag() {
|
||||||
|
// Make it win from other elements on the page.
|
||||||
|
// TODO: consider adding an id here to always win, since we are simulating shadow dom
|
||||||
|
// behavior here.
|
||||||
|
const highSpecifictyScope = `${this.scopedClass}.${this.scopedClass}`;
|
||||||
this.__styleTag.textContent = /** @type {typeof ScopedStylesController} */ (
|
this.__styleTag.textContent = /** @type {typeof ScopedStylesController} */ (
|
||||||
this.host.constructor
|
this.host.constructor
|
||||||
)
|
)
|
||||||
.scopedStyles(unsafeCSS(this.scopedClass))
|
.scopedStyles(unsafeCSS(highSpecifictyScope))
|
||||||
.toString();
|
.toString();
|
||||||
this.host.insertBefore(this.__styleTag, this.host.childNodes[0]);
|
this.host.insertBefore(this.__styleTag, this.host.childNodes[0]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue