Closed Bug 1854658 Opened 8 months ago Closed 8 months ago

Exportparts and ::part() selector leak internal component details

Categories

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

Firefox 117
defect

Tracking

()

VERIFIED FIXED
120 Branch
Tracking Status
firefox120 --- verified
firefox121 --- verified

People

(Reporter: vrugtehagel, Assigned: emilio)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0

Steps to reproduce:

Let's say we have the following markup structure:

<style>my-bar::part(text) { color: red; }</style>
<my-foo>
    #shadow-root
        <my-bar exportparts="text">
            #shadow-root
                <span part="text">Hello!</span>
        </my-bar>
</my-foo>

Here's a fiddle: https://jsfiddle.net/cj5z2kd9/

Actual results:

The text goes red.

Expected results:

The CSS rule should not apply; my-bar is not in the document (only my-foo is), so my-bar::part(text) should not apply even though my-bar is the tag name of the element that would be matched by ::part(text).

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Assignee: nobody → emilio
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

We need to jump to an element in the correct scope just like ::slotted()
does.

Factor that code to its own function both so that it's easier to reason
about and so that the code for that function remains small. At the end
of the day other combinators like descendant or sibling get executed a
ton of times (while pseudo-elements only jump once).

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d4e50ba4e3bb
Fix the part combinator to deal with exportparts correctly. r=zrhoffman
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/42281 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-120b-p2]

Reproducible on a 2023-10-01 Nightly build on macOS 12.
Verified as fixed on Firefox 120.0b5 and Nightly 121.0a1 on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-120b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: