Closed Bug 1850974 Opened 10 months ago Closed 8 months ago

:is(:host) doesn't work, but it probably should.

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: emilio, Assigned: emilio, Mentored)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached file Test-case

Blink (at least, haven't checked WebKit) also has this bug, fwiw. See attached test-case.

This prevents nesting from working with :host rules, because the & is expanded to :is(<parent-selector>).

To fix this, we should probably change this code to not look at whether we're a featureless host selector, but at whether :host might match at all, and insert those into host_rules too, alongside with putting it in the normal rules.

It's a bit tricky, and then we somehow need to prevent stuff like :is(#foo, :host(#bar)) from matching a host with id foo...

WebKit also fails this test-case.

Depends on: 1859917

Tests needed, but this should work per spec, see
https://github.com/w3c/csswg-drafts/issues/9509.

Tweak a bit the selector flags set up so that checking for :host
selectors during CascadeData rebuilds is cheap.

Tests needed for:

  • Basic cases.
  • Nesting.
  • Ancestor selector.
  • Ancestor selector with nesting.

So WIP for now.

Assignee: nobody → emilio
Attachment #9359671 - Attachment description: WIP: Bug 1850974 - Make :is(:host) work. → Bug 1850974 - Make :is(:host) work. r=#style,#layout
Status: NEW → ASSIGNED
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/42822 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Attachment #9359671 - Attachment description: Bug 1850974 - Make :is(:host) work. r=#style,#layout → Bug 1850974 - Make :is(:host) work. r=zrhoffman
Flags: needinfo?(emilio)
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Upstream PR merged by moz-wptsync-bot
Blocks: 1879349
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: