Because the diff2html.min.css is loaded inside a web component with shadow DOM it can not set the css variables on :root element.
Expected Results:
The styling is also applied when using inside a web component.
Relevant Code:
<template id="my-element">
<style>
:root {
color: red;
}
span {
border: 2px dotted black;
}
</style>
<span>I'm in the shadow DOM and I will NOT be red</span>
</template>
<div id="host"></div>
<span>I'm not in the shadow DOM</span>
Step 0: Describe your environment
Step 1: Describe the problem:
Steps to reproduce:
diff2html
to3.4.45
diff2html.min.css
inside a web component with shadow DOMdiff example:
Observed Results:
Because the diff2html.min.css is loaded inside a web component with shadow DOM it can not set the css variables on
:root
element.Expected Results:
The styling is also applied when using inside a web component.
Relevant Code:
Example on how the color is not set when using a variable that should be applied to
:root
: https://developer.mozilla.org/en-US/play?id=c3O%2FxsDE9LYm4ARVcuQ8%2Bc9RJO9xg8yfeGzAZNSsPRIwUjwbb3NOSM1pCXz5ic7Npjkl6UAIZyFOdwcxPossible solution:
Solution I often see is setting the variables to
:host
and:root
.