mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 21:41:40 +00:00

* Process sse-swap properly when swapped in Previously `sse-swap` were only processed when `sse-connect` was on the root of what was being swapped in. This is now fixed so that the closest sseEventSource is found and used as the event source * Pass for code readabiltiy remove the nested if statements as there is no difference in handling between sseURL and LegacySSEUrl. * Fix indenting * Initial attempt at sse extension tests * Make existing tests pass * Add test case for #916 * backport test for #916 to hx-sse for completeness * add a distinct test for sse-swap * more tests, fix tests + more tests differentiating the implementation of sse-swap and hx-trigger * fix for "is closed after removal with no close and activity" * Cleanup listener if element is gone * Revert "Cleanup listener if element is gone" This reverts commit bbe3715276302656d1a422fbc4778842776e35f6. * Clean up listeners if element gone, fix indenting * Incorportate feedback from first review + seperate eventSource creation logic and event registering logic + manually create event handling, still confused by how hx-trigger works * `createEventSourceOnElement` now looks for event sources in children * explicitly handle legacy sse handling instead of having extra selectors in `querySelectorOnThisOrChildren` + a few readability changes + add regression check to make sure that sseEventSource is only created on elements with sse-connect or equivalent + add test to make sure that sse-connect in the child of a swapped element is handled * Allow multiple listeners in eventsource mock * Backport eventsource mocks to legacy tests --------- Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>