diff --git a/src/htmx.js b/src/htmx.js index 64e0afa0..4f21c6c6 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -2559,6 +2559,7 @@ var htmx = (function() { const load = function() { if (!nodeData.loaded) { nodeData.loaded = true + triggerEvent(elt, 'htmx:trigger') handler(elt) } } diff --git a/test/attributes/hx-trigger.js b/test/attributes/hx-trigger.js index afd8db39..704e9ec9 100644 --- a/test/attributes/hx-trigger.js +++ b/test/attributes/hx-trigger.js @@ -1043,6 +1043,28 @@ describe('hx-trigger attribute', function() { }, 50) }) + it('fires the htmx:trigger event when the trigger is a load', function(done) { + this.server.respondWith( + 'GET', + '/test', + '