Bug 222733 - The :host() function pseudo-class should only accept a single compound-selector
Summary: The :host() function pseudo-class should only accept a single compound-selector
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 13
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
: 249420 (view as bug list)
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2021-03-04 05:04 PST by Anders Hartvoll Ruud
Modified: 2023-08-07 15:29 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***