Display shadow DOM content within a host element.
HTML
<span>I'm not in the shadow DOM</span>
<div class="host">
<template shadowrootmode="open">
<style>
/* @supports (-moz-appearance:none) {
:host {
div:has(.element) {
padding: 1em;
outline: 1px solid green;
}
}
} */
@scope (:host) to (.element) {
* {
padding: 1em;
outline: 1px solid red;
}
}
</style>
<div class="wrapper1">
<div class="wrapper2">
<span class="element">I'm in the shadow DOM</span>
</div>
</div>
</template>
</div>
CSS
.host {
background-color: salmon;
}