Closed
Bug 1470545
Opened 6 years ago
Closed 6 years ago
Add a "shadowrootattached" event for devtools.
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
Details
Attachments
(1 file)
No description provided.
Comment 1•6 years ago
|
||
Since devtools also can access closed shadow roots via openOrClosedShadowRoot,
they can add the event listener to the shadow root to handle nested shadows
like:
function onShadowRootAttached(e) {
e.target.openOrClosedShadowRoot.addEventListener(
"shadowrootattached", onShadowRootAttached);
// Other stuff...
}
document.addEventListener(
"shadowrootattached", onShadowRootAttached);
I didn't bother to add tests for the event itself since this is going to get
tested in bug 1449333, but I can look into writing a chrome mochitest if you
want.
Assignee | ||
Updated•6 years ago
|
Attachment #8987171 -
Flags: review?(bugs)
Comment 2•6 years ago
|
||
Why the need to add more listeners? Adding listener to chrome event handler and then using composedTarget should be fine.
Assignee | ||
Comment 3•6 years ago
|
||
Hmm, when you have nested closed shadow roots, isn't the composed target when the event handler on the document fires the topmost one? I don't think you can reach to the actual shadow host in that case, can you?
Anyway, if there's a way to do this without those nested listeners that's great.
Assignee | ||
Comment 4•6 years ago
|
||
Ohh, nevermind, composedTarget isn't retargeted, and is chromeonly.
Assignee | ||
Comment 5•6 years ago
|
||
(So, yes, would work)
Comment 6•6 years ago
|
||
.target is the topmost one.
.composedTarget is ChromeOnly thing, https://searchfox.org/mozilla-central/rev/9a3f8590f807d449e790c8ba0e39eb14f41066d8/dom/events/Event.cpp#287 returning basically the deepest non-NAC target.
Updated•6 years ago
|
Attachment #8987171 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 7•6 years ago
|
||
Comment on attachment 8987171 [details]
Bug 1470545: Add chromeonly "shadowrootattached" event for devtools. r=smaug
I updated the Phabricator a while ago, forgot to update the flag here.
Attachment #8987171 -
Flags: review- → review?(bugs)
Comment 8•6 years ago
|
||
Comment on attachment 8987171 [details]
Bug 1470545: Add chromeonly "shadowrootattached" event for devtools. r=smaug
Olli Pettay [:smaug] has approved the revision.
https://phabricator.services.mozilla.com/D1777
Attachment #8987171 -
Flags: review+
Updated•6 years ago
|
Attachment #8987171 -
Flags: review?(bugs)
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/65df1f8bb3cb
Add chromeonly "shadowrootattached" event for devtools. r=smaug
Comment 10•6 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in
before you can comment on or make changes to this bug.
Description
•