VOOZH about

URL: https://bugzilla.mozilla.org/1966844

⇱ 1966844 - -moz-element does not work inside shadow dom / webcomponents


Closed Bug 1966844 Opened 1 year ago Closed 1 month ago

-moz-element does not work inside shadow dom / webcomponents

-moz-element does not work inside shadow dom / webcomponents
Core
Layout
Trunk
Unspecified
Unspecified
defect
Points:
---
RESOLVED FIXED
RESOLVED
FIXED
152 Branch
Iteration:
---
a11y-review
Accessibility Severity
Performance Impact
Size Estimate
Webcompat Priority
Webcompat Score
Tracking Status
firefox152 --- fixed
Tracking Status
relnote-firefox
thunderbird_esr115
thunderbird_esr140
firefox-esr115
firefox-esr140
firefox-esr153
firefox152
firefox153
firefox154
---
QA Whiteboard:
[qa-triage-done-c153/b152]
Has STR:
---
Change Request:
---
Bug Flags:
Signature:
None
This bug is publicly visible.

 
Reporter

Description

β€’
1 year ago

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Steps to reproduce:

Try to use the -moz-elemnt function inside of a webcomponent. It will not show the content set
look at:
https://jsbin.com/wokuburayi/edit?html,output

Actual results:

nothing is displayed

Expected results:

it should also display the content. cause the document.mozSetImageElement has no scope

The Bugbug bot thinks this bug should belong to the 'Toolkit::UI Widgets' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged β†’ UI Widgets
Product: Firefox β†’ Toolkit
Component: UI Widgets β†’ DOM: Core & HTML
Product: Toolkit β†’ Core

This belongs to layout I think

Component: DOM: Core & HTML β†’ Layout

So there are two things wrong here. One is that the lookup code is wrong. But even with that fixed, it wouldn't work because DocumentOrShadowRoot::LookupImageElement doesn't look at the global element table. That's where I'd look to fix this. We probably need to fix the dynamic change watching too, to some extent. So maybe it's worth doing it in the caller (FindTreeToWatch).

Mentor: emilio
Severity: -- β†’ S3
Status: UNCONFIRMED β†’ NEW
Ever confirmed: true
Keywords: good-next-bug
Priority: -- β†’ P3
Summary: -moz-element does not work inside webcomponents β†’ -moz-element does not work inside shadow dom / webcomponents

Comment 4

β€’
2 months ago

Hello kcochrane: nikkis: sfoster:

Please can I work on this bug?

Yeah by all means, let me know if you have any questions?

Comment 6

β€’
2 months ago

Hi Emilio,

I appreciate the opportunity to work with great minds like you on a project like this.
However, I just realized that contributions outside Firefox will not count toward my Outreachy contribution phase for the Firefox project, so I would not be able to work on this at the moment. I hope that after this phase, I may still have the opportunity to be part of your community and contribute meaningful solutions.

Thank you.

Assignee

Comment 7

β€’
1 month ago

Hi :emilio, I'd like to work on this bug.
From your comment, I understand there are two things to fix:

  1. DocumentOrShadowRoot::LookupImageElement needs to fall back to the host document's global element table when called from a shadow root context.
  2. FindTreeToWatch needs to be updated to watch for dynamic changes across the shadow boundary.

May I take this up?

Flags: needinfo?(emilio)

That sounds right! Sure, please go ahead, once you submit the patch the bug should be assigned to you.

Flags: needinfo?(emilio)
Reporter

Comment 9

β€’
1 month ago

But via Api I still would be able to assign an element from any shadow root?

Wdym with "via api"? You mean mozSetImageElement? I'd expect that to take priority yeah.

Reporter

Comment 11

β€’
1 month ago

But will it work across different shadowdoms? It does not at the moment

Assignee: nobody β†’ becomevsr
Status: NEW β†’ ASSIGNED
Attachment #9584805 - Attachment description: Bug 1966844 - Make -moz-element work inside shadow dom / webcomponents. r?emilio β†’ Bug 1966844 - Make -moz-element work inside shadow dom / webcomponents.
Attachment #9584805 - Attachment description: Bug 1966844 - Make -moz-element work inside shadow dom / webcomponents. β†’ Bug 1966844 - Make -moz-element work inside shadow dom / webcomponents. r=emilio
Assignee

Comment 13

β€’
1 month ago

Hey :emilio, this might be out of topic but I followed your article on Windows MSYS2 using zsh yesterday. I was considering to move all my firefox source build to WSL, but yours was simpler and worked well. Especially the pip path fix (AI couldn't help me there). Thanks for writing this!

Comment 14

β€’
1 month ago
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/88b911b72c63 https://hg.mozilla.org/integration/autoland/rev/a3dc227910c1 Make -moz-element work inside shadow dom / webcomponents. r=emilio,firefox-style-system-reviewers,layout-reviewers

Comment 15

β€’
1 month ago
bugherder
Status: ASSIGNED β†’ RESOLVED
Closed: 1 month ago
Resolution: --- β†’ FIXED
Target Milestone: --- β†’ 152 Branch
QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.