htmx icon indicating copy to clipboard operation
htmx copied to clipboard

Dom is parsed before the sse extension being loaded when using "defer"

Open twidi opened this issue 3 years ago • 1 comments

I want to use the new sse extension but it doesn't work when using "defer" because the dom is "parsed" by htmx before the load of the extension.

I declare the script tags in my <head> like this:

<script src="https://unpkg.com/[email protected]" defer></script>
<script src="https://unpkg.com/[email protected]/dist/ext/sse.js" defer></script>

This way a tag with hx-ext="sse" already in place in the dom won't be handled by the extension because the sse extension is loaded after the initial "parse", and the extension doesn't do a new "parse".

PS: when not using defer, it works as expected

twidi avatar May 19 '22 12:05 twidi

@twidi Had the same issue, did you find a workaround?

Tobi-De avatar Aug 27 '22 18:08 Tobi-De