Fix binding event handlers using latest snabbdom#8
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). |
|
Thanks a lot! I’m trying to keep the code as tiny as possible so before merging, could you figure out a neat way to do the list of names shorter? Maybe just traverse the properties on a node or look inside snabbdom for a list we can reuse? |
|
It certainly could be smaller to just try to detect attributes starting with "on" but it would trigger on attributes like "only-data" or "on-custom-attribute" which would result in those attributes going missing and being added as a weird event handler. I think that would add a gotcha that users would probably complain about. Alternatively, we could just move the list into another file and import it. It would be a bit neater. I don't think it really adds all that much to the code size and would be easier to maintain than the regex, since new events will be added in the future by the browsers. |
|
script to generate the regex. |
I was trying out pureact but element event handlers were not being bound correctly using snabbdom 0.7.4. I figured out this fix and figured I would contribute it.