Bug 232402 - :empty selector matches elements with a shadow root
Summary: :empty selector matches elements with a shadow root
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-27 14:04 PDT by Luke Warlow
Modified: 2021-10-29 12:19 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Warlow 2021-10-27 14:04:23 PDT
Steps to reproduce:

Go to https://jsfiddle.net/hyjfkwqx/
You should see there is no output.

Actual results:

The :empty selector matches an element with an open shadow root that itself has child elements. So the parent div is not displayed.

Expected results:

I would expect the :empty selector to not match these elements. So I would expect to see a red square with a smaller blue square in it.
Comment 2 Luke Warlow 2021-10-29 08:27:36 PDT
I made an issue in the CSSWG github just in case it's a spec "issue" rather than a browser one. https://github.com/w3c/csswg-drafts/issues/6771
Comment 3 Emilio Cobos Álvarez (:emilio) 2021-10-29 12:19:20 PDT
Let's reopen if the CSSWG decides to change behavior here but this is invalid as per spec.