Uncaught TypeError: Cannot read property 'appendChild' of null (anonymous) How to change CSS property of ShadowRoot (open)?

Uncaught TypeError: Cannot read property 'appendChild' of null (anonymous) How to change CSS property of ShadowRoot (open)?

ShadowRoot(打开)

我想更改此 ShadowRoot 的 z-index 值。

host = document.getElementById("shadow-root");
var style = document.createElement( 'style' )
 style.innerHTML = '.rssapp { z-index: -1; }'
 host.shadowRoot.appendChild( style )
// var sheet = new CSSStyleSheet
// sheet.replaceSync( `.rssapp { z-index: -1 }`)
// host.shadowRoot.adoptedStyleSheets = [ sheet ] 

我尝试了上面的代码,包括注释的和未注释的,但两次都显示 Uncaught TypeError: Cannot read 属性 'shadowRoot' of null 在 script.js:35 (匿名) 或者 Uncaught TypeError: 无法读取 null 的 属性 'shadowRoot' 在 script.js:38 (匿名)分别

编辑: 我也尝试使用 ID XQqyAJD0d17SWeNW

能不能只给所选元素添加样式?使用 Jquery 也许:

$('#shadow-root .rssapp').attr('style', 'z-index:-1');

或者可能是这样的:

$('.rssapp').attr('style', 'z-index:-1');

请告诉我这是否有效。