bigskysoftware / bigskysoftware/htmx
Cannot trigger an action on window.load event
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
Hi,
it seems that if I try to trigger an action on window.load event:
`
the action is triggered immediately. If I understand correctly, it's due to this code:
```
else if (triggerSpec.trigger === "load") {
if (!maybeFilterEvent(triggerSpec, makeEvent("load", {elt:elt}))) {
loadImmediately(elt, handler, nodeData, triggerSpec.delay);
}
}
```
which assumes "load" is always htmx:load, which I guess is always triggered immediately (unless filtered away)?
Would an appropriate fix be something like
```
else if (triggerSpec.trigger === "load" && elt !== window) { ... }
```
or is something more sophisticated needed?
Contributor guide
Assessment
This issue has not been assessed yet.