New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support composed events to cross the Shadow DOM boundary #5054
Comments
Hi @AlexKamaev From the jQuery Docs for .trigger()
In your code, you are register the custom_event by binding onto document. Therefore, .trigger('custom_event') must also be executed on the same element (i.e. document - in this case). Also, you had accidentally added two handlers to btnDispatch - but that's not the main reason for failure. Updating the last few lines from your example to -
fixes the problem. |
Thanks for the report. There's no support for the I'll add this to the milestone to not forget. I also updated the title to be more straight to the point. |
@dmethvin do you see anything fundamentally against this idea? Or is it fine to research this for |
A cleaned up test case: https://jsbin.com/mutoqep/1/edit?html,js,output |
Researching this sounds fine. We've talked about using the native |
jQuery version is 3.6.0.
What do you expect to happen?
I want to somehow handle event which was triggered by the
trigger
method inside the ShadowDOMWhat actually happens?
Nothing happened. The triggered events do not bubbles out of ShadowDOM.
For native events I can use the
composed
property. But it looks like I cannot do the same with jQuery events and thetrigger
method.Which browsers are affected?
Chrome
Description
Please take a look at the example I provided: https://output.jsbin.com/joxayaxoki/1
When I click on the
Dispatch Button
it works perfectly.How can I achieve the same result with the
Trigger Button
.Link to test case
https://output.jsbin.com/joxayaxoki/1
The text was updated successfully, but these errors were encountered: