RESOLVED DUPLICATE of bug 277893289948
Web Inspector: CSS is read-only when applied via adoptedStyleSheets
https://bugs.webkit.org/show_bug.cgi?id=289948
Summary Web Inspector: CSS is read-only when applied via adoptedStyleSheets
Vadim Makeev
Reported 2025-03-18 04:19:40 PDT
Created attachment 474601 [details] Two shadowroots with different style attachment approaches When CSS is attached to a shadow root via `adoptedStyleSheets` (constructable stylesheets), the internal elements could not be debugged (styles modified). ``` const sheet = new CSSStyleSheet(); sheet.replaceSync(` div { width: 256px; height: 256px; background-color: tomato; } `); root.adoptedStyleSheets = [sheet]; ``` Styles are locked and marked as User Agent Stylesheet. But when styles are attached using DOM, everything is fine: ``` const style = document.createElement('style'); style.textContent = ` div { width: 256px; height: 256px; background-color: lightgreen; } `; root.appendChild(style); ``` See the attached demo comparing to approaches.
Attachments
Two shadowroots with different style attachment approaches (1.05 KB, text/html)
2025-03-18 04:19 PDT, Vadim Makeev
no flags
Vadim Makeev
Comment 1 2025-03-18 06:48:02 PDT
I turned out you don’t even need the shadow root. Any styles applied via `adoptedStyleSheets` are read-only in Web Inspector.
Radar WebKit Bug Importer
Comment 2 2025-03-18 09:30:37 PDT
Vadim Makeev
Comment 3 2025-05-16 23:08:41 PDT
Anthony Ricaud
Comment 4 2025-05-17 01:02:10 PDT
*** This bug has been marked as a duplicate of bug 277893 ***
Note You need to log in before you can comment on or make changes to this bug.