Separate theatre's root from playground's
This commit is contained in:
parent
c919aa2f22
commit
53c3302cab
1 changed files with 18 additions and 9 deletions
|
@ -25,15 +25,24 @@ export default class UI {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
`
|
`
|
||||||
this.containerShadow =
|
|
||||||
window.__IS_VISUAL_REGRESSION_TESTING === true
|
const createShadowRoot = (): ShadowRoot & HTMLElement => {
|
||||||
? (document.getElementById('root') as $IntentionalAny)
|
if (window.__IS_VISUAL_REGRESSION_TESTING === true) {
|
||||||
: (this.containerEl.attachShadow({
|
const fauxRoot = document.createElement('div')
|
||||||
mode: 'open',
|
fauxRoot.id = 'theatrejs-faux-shadow-root'
|
||||||
// To see why I had to cast this value to HTMLElement, take a look at its
|
document.body.appendChild(fauxRoot)
|
||||||
// references of this prop. There are a few functions that actually work
|
return fauxRoot as $IntentionalAny
|
||||||
// with a ShadowRoot but are typed to accept HTMLElement
|
} else {
|
||||||
}) as $IntentionalAny as ShadowRoot & HTMLElement)
|
return this.containerEl.attachShadow({
|
||||||
|
mode: 'open',
|
||||||
|
// To see why I had to cast this value to HTMLElement, take a look at its
|
||||||
|
// references of this prop. There are a few functions that actually work
|
||||||
|
// with a ShadowRoot but are typed to accept HTMLElement
|
||||||
|
}) as $IntentionalAny
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.containerShadow = createShadowRoot()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in a new issue