You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently slots are not properly rendered when the the entrypoint defining the custom elements and associated Svelte components run prior to the initial parsing of the DOM. As the parser processes HTML, it will encounter the custom element and immediately as soon as it is encountered, it will execute the constructor() and connectedCallback() functions even before it has reached the interior containing the slots.
Describe the proposed solution
Use MutationObserver to watch for changes and re-render the component once slots are encountered. This is how shadow DOM slots are already being addressed.
Alternatives considered
Await tick() (e.g. setTimeout() with 0ms delay) to wait until thread is no longer blocking, but this is super hacky and also causes a flicker. The requestAnimationFrame() would be similarly as hacky if not induce a longer delay.
Note: Very important to me since our components are compiled as IIFE's (see rollup docs) and included early in the page load (i.e. in the <head>) and thus this currently renders slots unusable.
Importance
i cannot use svelte-retag without it
The text was updated successfully, but these errors were encountered:
Describe the problem
Currently slots are not properly rendered when the the entrypoint defining the custom elements and associated Svelte components run prior to the initial parsing of the DOM. As the parser processes HTML, it will encounter the custom element and immediately as soon as it is encountered, it will execute the
constructor()
andconnectedCallback()
functions even before it has reached the interior containing the slots.Describe the proposed solution
Use
MutationObserver
to watch for changes and re-render the component once slots are encountered. This is how shadow DOM slots are already being addressed.Alternatives considered
Await
tick()
(e.g.setTimeout()
with 0ms delay) to wait until thread is no longer blocking, but this is super hacky and also causes a flicker. TherequestAnimationFrame()
would be similarly as hacky if not induce a longer delay.Note: Very important to me since our components are compiled as IIFE's (see rollup docs) and included early in the page load (i.e. in the
<head>
) and thus this currently renders slots unusable.Importance
i cannot use svelte-retag without it
The text was updated successfully, but these errors were encountered: