I have a web page which is the 3rd vendor app. In this page there is lots of code which creates some constructed styles. I wanted to create a chrome extensions to move one of divs around the page. I tried to inject JS and CSS but it worked only with normal styles, not constructed once. What could I do to change a Constructable Stylesheet, for example "width" value for the div in shadow DOM?
Update: replace
will do a job as per comments below but how to find the shadow object is now a question
<!DOCTYPE html>
<html>
<body>
<script>
body = document.querySelector("body");
const shadow = body.attachShadow( {mode: 'open'});
shadow.innerHTML = "<p>New2</p>";
const bgPurple = new CSSStyleSheet();
const everythingTomato = new CSSStyleSheet();
bgPurple.replace(`p {font-weight: bold; }`);
everythingTomato.replace(`* { color: tomato; }`);
shadow.adoptedStyleSheets = [everythingTomato, bgPurple];
</script>
<script>
const everythingTomato2 = new CSSStyleSheet();
everythingTomato2.replace(`* { color: red; }`);
shadow.adoptedStyleSheets = [everythingTomato2];
/*How to find "shadow" to use adoptedStyleSheets? The first code is given not clear, I can only change this one. */
</script>
</body>
</html>