WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 279225
276454
Style doesn't update on :scope when an element is no longer a candidate for a CSS Scope rule
https://bugs.webkit.org/show_bug.cgi?id=276454
Summary
Style doesn't update on :scope when an element is no longer a candidate for a...
Zacky Ma
Reported
2024-07-10 16:24:47 PDT
When an element is changed and should no longer be selected by a scope rule, the styles defined in `:scope` persists. For example, given the CSS code: ``` body { color: black; } @scope (.foo) { :scope { color: red; } :scope::after { content: ' more text'; } span { color: green; } } ``` and the HTML code: ``` <body> <p class="foo">Some <span>text</span></p> </body> ``` When `foo` class is removed from `<p>`, the text color in `<p>` remains as red, instead of falling back to be the body color (black); "more text" remains instead of being removed. But the text color in `<span>` is correctly falling back to its parent's color, which is red. Testing Codepen:
https://codepen.io/marchbox/pen/JjQovBp
Attachments
Add attachment
proposed patch, testcase, etc.
Zacky Ma
Comment 1
2024-07-10 16:26:01 PDT
Should've also mentioned, forcing the element to be repainted, e.g. setting `<p>` with `visibility: hidden` then reset `visibility` does correct the styles.
Radar WebKit Bug Importer
Comment 2
2024-07-17 16:31:24 PDT
<
rdar://problem/131962940
>
Matthieu Dubet
Comment 3
2025-08-06 15:40:57 PDT
*** This bug has been marked as a duplicate of
bug 279225
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug