Bug 249420 - :host(.foo, .bar) should be an invalid selector
Summary: :host(.foo, .bar) should be an invalid selector
Status: RESOLVED DUPLICATE of bug 222733
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2022-12-15 11:43 PST by Nolan Lawson
Modified: 2023-08-07 15:29 PDT (History)
6 users (show)

See Also:


Attachments
Repro comparison in Chromium, Firefox, and WebKit (259.11 KB, image/png)
2022-12-15 11:44 PST, Nolan Lawson
no flags Details
Minimal repro (479 bytes, text/html)
2022-12-15 11:44 PST, Nolan Lawson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nolan Lawson 2022-12-15 11:43:58 PST
Per the CSS spec (https://w3c.github.io/csswg-drafts/css-scoping/#host-selector), `:host()` accepts a compound selector. However, in WebKit it seems to support a selector list.

This leads to different behavior between WebKit and Chromium/Firefox in this case:

    :host(.foo, .bar) { }

Chromium and Firefox ignore the selector, whereas WebKit styles a host with the "foo" class. Here is a CodePen demo: https://codepen.io/nolanlawson-the-selector/pen/gOKVBMO . (The attached HTML file is equivalent.)

In this demo, the CSS rule sets the test color to red. In WebKit the text appears red, whereas in Chromium and Firefox it appears black.

Tested in Safari Technology Preview 146 (Safari 15.4, WebKit 16614.1.14.10.6).

May be related to: https://bugs.webkit.org/show_bug.cgi?id=220532
Comment 1 Nolan Lawson 2022-12-15 11:44:28 PST
Created attachment 464059 [details]
Repro comparison in Chromium, Firefox, and WebKit
Comment 2 Nolan Lawson 2022-12-15 11:44:57 PST
Created attachment 464060 [details]
Minimal repro
Comment 3 Radar WebKit Bug Importer 2022-12-22 11:44:19 PST
<rdar://problem/103645394>
Comment 4 Ahmad Saleem 2023-08-06 15:56:04 PDT
Safari 16.6 is now matching Chrome Canary 117 and Firefox Nightly 118 in minimal repo and it seems to be fixed now.

Marking this as 'RESOLVED CONFIGURATION CHANGED" and CCing - Tim for any input.
Comment 5 Tim Nguyen (:ntim) 2023-08-07 15:29:23 PDT

*** This bug has been marked as a duplicate of bug 222733 ***