-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(core): Add support to shadow DOM for QwikLoader. #6547
Conversation
✅ Deploy Preview for qwik-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
commit: @builder.io/qwik
@builder.io/qwik-city
eslint-plugin-qwik
create-qwik
|
So turns out that you can't use I think a better way to do it is for the QwikLoader to query |
Shadow DOM can be used to isolate an application. The isolation also includes: - Events don't bubble across shadow boundaries. - QuerySelector doesn't cross shadow boundaries. QwikLoader relies on both event bubbling and querySelector to process events such as `on:click` and dispatch such as `on-window:resize`. To enable QwikLoader to work with shadow DOM, it is necessary to tell qwikloader that when it is registering an event listener, as well as performing querySelector, it should do so not just on document but also inside the shadow DOM. To do that it is the responsibility of the developer to tell qwikloader about the shadow DOM roots. CONSTRAINTS: The qwikloader applications `q:container` must be fully inside the shadow root. (i.e. the application itself must not cross the shadow DOM boundaries.) Developer responsibility: (choose one) - Have qwik loader find the roots by annotate the elements which have shadow DOM with `q:shadowRoot` attribute. - Manually insert a `<script>` tag into HTML which will add the shadow DOM root into the qwikloader's `qwikevents` array. Example: Possible implementation ```html <div id="my-child" q:shadowRoot> <template shadowrootmode="open"> <div q:container="..." q:base="..."...>qwik-container here</div> </template> </div> ``` Fixes: #6546
Shadow DOM can be used to isolate an application. The isolation also includes: - Events don't bubble across shadow boundaries. - QuerySelector doesn't cross shadow boundaries. QwikLoader relies on both event bubbling and querySelector to process events such as `on:click` and dispatch such as `on-window:resize`. To enable QwikLoader to work with shadow DOM, it is necessary to tell qwikloader that when it is registering an event listener, as well as performing querySelector, it should do so not just on document but also inside the shadow DOM. To do that it is the responsibility of the developer to tell qwikloader about the shadow DOM roots. CONSTRAINTS: The qwikloader applications `q:container` must be fully inside the shadow root. (i.e. the application itself must not cross the shadow DOM boundaries.) Developer responsibility: (choose one) - Have qwik loader find the roots by annotate the elements which have shadow DOM with `q:shadowRoot` attribute. - Manually insert a `<script>` tag into HTML which will add the shadow DOM root into the qwikloader's `qwikevents` array. Example: Possible implementation ```html <div id="my-child" q:shadowRoot> <template shadowrootmode="open"> <div q:container="..." q:base="..."...>qwik-container here</div> </template> </div> ``` Fixes: QwikDev#6546
feat(core): Add support to shadow DOM for QwikLoader.
Shadow DOM can be used to isolate an application. The isolation also
includes:
QwikLoader relies on both event bubbling and querySelector to process
events such as
on:click
and dispatch such ason-window:resize
.To enable QwikLoader to work with shadow DOM, it is necessary to tell
qwikloader that when it is registering an event listener, as well as
performing querySelector, it should do so not just on document but also
inside the shadow DOM. To do that it is the responsibility of the
developer to tell qwikloader about the shadow DOM roots.
CONSTRAINTS:
The qwikloader applications
q:container
must be fully inside theshadow root. (i.e. the application itself must not cross the shadow DOM
boundaries.)
Developer responsibility: (choose one)
shadow DOM with
q:shadowRoot
attribute.<script>
tag into HTML which will add the shadow DOMroot into the qwikloader's
qwikevents
array.Example:
Possible implementation
Fixes: #6546