[Webkit-unassigned] [Bug 276454] New: Style doesn't update on :scope when an element is no longer a candidate for a CSS Scope rule

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 10 16:24:47 PDT 2024


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

            Bug ID: 276454
           Summary: Style doesn't update on :scope when an element is no
                    longer a candidate for a CSS Scope rule
           Product: WebKit
           Version: Safari 17
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: zacky at marchbox.com
                CC: koivisto at iki.fi

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

-- 
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/20240710/f9add163/attachment.htm>


More information about the webkit-unassigned mailing list