[Webkit-unassigned] [Bug 270864] Web Inspector: CSSOM styles inserted in Console don't immediately show up in the styles details panel

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 12 10:55:25 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=270864

--- Comment #2 from Qianlang Chen <qianlangchen at apple.com> ---
It appears that only CSSOM styles added this way don't immediately show up.

Adding an attribute style this way does show up:
    document.querySelector('body').style.opacity = 0.5;

Or adding an internal style sheet, which also shows up:
    el = document.createElement('style');
    el.textContent = 'body { opacity: 0.5; }';
    document.querySelector('head').appendChild(el);

But the example in the bug description do not show up.

Similarly in this example, the background-color style does not show up:
    el = document.createElement('style');
    el.textContent = 'body { opacity: 0.5; }';
    document.querySelector('head').appendChild(el);
    document.styleSheets[0].insertRule('body { background-color: linen; }', 0);

However in the last example it's even worse, you'll need to re-open the inspector altogether to see the background-color style. Simply re-inspecting <body> shows there's a new rule but it's empty. Only re-opening puts "background-color: linen" in that new rule.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240312/5692d06f/attachment.htm>


More information about the webkit-unassigned mailing list