Closed Bug 1618509 Opened 5 years ago Closed 5 years ago

Allow to export multiple parts with a single part name (was: Cannot export shadow part with an alias)

Categories

(Core :: CSS Parsing and Computation, task)

Unspecified
All
task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox73 --- wontfix
firefox74 --- wontfix
firefox75 --- wontfix
firefox76 --- fixed

People

(Reporter: csvn.dev, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0

Steps to reproduce:

  1. Create an element with a shadowRoot that has a Shadow part named foo
  2. Create a parent element with a shadowRoot, that includes the element mentioned above.
  3. Set the exportparts attribute on the parent to export and export+rename the part: "foo, foo: bar"
  4. Create CSS to style ::part(foo) and ::part(bar) separately

Reproduction example:
https://jsfiddle.net/957hns23/2/

Actual results:

Only the first instance of the part will work with the styling, foo if "foo, foo: bar", bar if "foo: bar, foo".

Expected results:

Both parts foo and bar should work with the styling

I was able to reproduce the issue on Firefox 73.0.1 and Firefox 75.0a1
I'm setting a component in order to involve the development team in reviewing this issue.

Thank you for reporting!

Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Core & HTML
Ever confirmed: true
OS: Unspecified → All
Product: Firefox → Core
Version: 73 Branch → Trunk
Component: DOM: Core & HTML → CSS Parsing and Computation
Blocks: shadow-parts
Summary: Cannot export shadow part with an alias → Allow to export multiple parts with a single part name (was: Cannot export shadow part with an alias)

Other browsers allow this and the spec doesn't really disallow it, so fix it,
add a test and carry on.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Type: defect → task

Thanks Emilio, I was not certain if this was explicitly stated in the spec. I just thought it might be a common use case (see below), and that It was possible to do this in Chrome when I tested it there too.

<x-post>
  #shadow
    <x-profile exportparts="avatar"></x-profile>
</x-profile>

<x-user>
  #shadow
    <x-profile exportparts="avatar user"></x-profile>
</x-profile>

<style>
::part(avatar) {
  border-radius: 50%;
}
::part(avatar user) {
  border-color: red;
}
</style>

Yeah, Safari allows this too. Too bad none of the other two engines landed a web-platform-test, otherwise I would've caught this when implementing shadow parts. Oh well...

If it gets reviewed soonish it should land in Firefox 75, otherwise 76 it is.

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0bad929ac77b Allow to export a shadow part under multiple names. r=jwatt
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/22140 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
Upstream PR merged by moz-wptsync-bot

Does this need a Beta approval request or can this ride 76 to release?

Flags: in-testsuite+

I think it can ride the trains. It's a minor bug-fix / feature.

Flags: needinfo?(emilio)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: