swapError with hx-on and hx-swap="innerHTML"
I'm getting a swapError whilst trying to hx-swap="innerHTML" an element which has the new hx-on attribute.
I've put together this jsfiddle to demonstrate the issue (click the "Swap" button and look at the console).
I've also put together this jsfiddle which demonstrates a similar behavior working using hyperscript.
I've read through the docs for hx-on and don't see any limitations outlined which would prevent my example from working.
Edit 1:
It looks like it's trying to perform for...of loop over an object.

Edit 2:
Simply switching it to a for...in works and all the tests pass.

Edit 3:
I'm going to add a failing test, then I'll test my code against that and open up a PR to be reviewed.
I've opened a pull request.
I've made the for...of -> for...in change and added a test under hx-on which checks that hx-on works before and after being swapped using innerHTML.
I wasn't sure if to add a hasOwnProperty check as most of the code which uses for...in does, however in processHxOn the check is ommited.
Happy to discuss and update the PR as needed.
I can confirm this issue. I update some element classes on htmx:beforeRequest and htmx:afterRequest with hx-on, resulting in the same error. The proposed fix works for me.