Bug 222733

Summary: The :host() function pseudo-class should only accept a single compound-selector
Product: WebKit Reporter: Anders Hartvoll Ruud <andruud>
Component: CSSAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: emilio, koivisto, nlawson, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    

Description Anders Hartvoll Ruud 2021-03-04 05:04:55 PST
It appears that Webkit currently accepts a <compound-selector-list> parse-time (but then it doesn't fully work at selector-matching-time)?

In any case, the correct grammar is now: :host( <compound-selector> )

https://drafts.csswg.org/css-scoping/#selectordef-host

Test:

<!DOCTYPE html>
<template id=template>
  <style>
    :host(#host1) slot { color: green; }
    :host(#host2, #host3) slot { color: green; }
  </style>
  <slot></slot>
</template>
<div id=host1><span>Should be green</span></div>
<div id=host2><span>Should not be green</span></div>
<div id=host3><span>Should not be green</span></div>
<script>
  host1.attachShadow({mode:'open'}).append(template.content.cloneNode(true));
  host2.attachShadow({mode:'open'}).append(template.content.cloneNode(true));
  host3.attachShadow({mode:'open'}).append(template.content.cloneNode(true));
</script>
Comment 1 Radar WebKit Bug Importer 2021-03-11 05:05:15 PST
<rdar://problem/75311716>
Comment 2 Ryosuke Niwa 2022-07-03 16:31:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/2045
Comment 3 EWS 2022-07-03 22:29:48 PDT
Committed 252110@main (e91f2366aef4): <https://commits.webkit.org/252110@main>

Reviewed commits have been landed. Closing PR #2045 and removing active labels.
Comment 4 Tim Nguyen (:ntim) 2023-08-07 15:29:23 PDT
*** Bug 249420 has been marked as a duplicate of this bug. ***