piranha / twinspark-js

Declarative enhancement for HTML: simple, composable, lean.
https://twinspark.js.org/
MIT License
421 stars 20 forks source link

'ts-req-selector="children ul"' doesn't activate children elements #26

Closed last-arg closed 1 year ago

last-arg commented 1 year ago

Example:

<div ts-req="<url>" ts-trigger="load" ts-swap="replace" ts-req-selector="children ul"></div>

Problem: When using 'ts-req-selector="children ul"' for swapping it will use DocumentFragment. But during swap DocumentFragment will become empty. This means activate() function will be called on DocumentFragment with no children - no elements will be activated. And 'ts-ready' event will not fire.

Not sure if it is wanted behaviour or not?

piranha commented 1 year ago

Ah, that's a bug, thanks for heads up! Dammit I knew DocumentFragment will trip me somewhere, they always do. 😁

I'll look into that later on - or you can take a swing at it if you want. :)