Bug 249420

Summary: :host(.foo, .bar) should be an invalid selector
Product: WebKit Reporter: Nolan Lawson <nlawson>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ahmad.saleem792, karlcow, koivisto, ntim, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Repro comparison in Chromium, Firefox, and WebKit
none
Minimal repro none

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 ***