Repository navigation
Cannot listen to event htmx:responseError at window scope #2916
Answered
by
SimoTod
alarbada
asked this question in
7. Bugs (archived)
|
Hello there! Maybe I'm doing something wrong, but as far as I know: <div x-data="{ error: false }">
<div x-on:htmx:responseError.camel.window="error = true"></div>
<div x-show="error">
Im a happy little error
</div>
</div>This should work, but it doesn't with the current alpine cdn script. At first I thought it could be something with the colon character in the htmx event, but I can listen to other events fired by htmx on the window element, so that gets discarted. And the camel modifier should work as expected. I've checked that this works as expected: <div x-data="{ error: false }">
<div x-init="window.addEventListener('htmx:responseError', () => error = true)"></div>
<div x-show="error">
Im a happy little error
</div>
</div>So I assume it must be something with how alpinejs interprets events. Other people are also having this kind of error: https://dev.to/preslavrachev/comment/1ijeh Any ideas? |
Answered by
SimoTod
May 9, 2022
Replies: 1 comment 2 replies
|
Attributes are case insensitive (which is way alpine has the camel modifier). You can't use |
2 replies
Answer selected by
alarbada
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attributes are case insensitive (which is way alpine has the camel modifier). You can't use
on:htmx:responseError, I think it should beon:htmx:response-error.camel