Open LucaColonnello opened 9 years ago
I think Incremental DOM handles passing events via onclick type attributes. So we should be able to make something work. If you'd like to take a shot and submit a PR that would be great. I will look at it some too.
Ok @ericponto, let me do some considerations:
Could make sense for you?
Obviously if we don't wanna give all of these responsibilities to this library, we have to make developers able to create own libs using this one, but making it possible to solve all of these issues...
For example we can implement some callback for attribute changes (checking Incremental DOM possibilities) and giving a context to the parser where converts attributes values to handlers (as event callback) or other operations..
My though is that you could use any string based template system, so don't want to limit it to ES6 template strings.
I think the html parser could catch all the attributes that start with "on" and then we could do anything we want with them. And yeah, for delegation we probably need to keep track of all the events somehow, then compare when patchHTML
is called.
Yeah, but the problem is that by now tha parser doesn't know the context that contains all the event handlers.. Could we make this context shared with the parser? Probably we have to create multiple parser instances or pass to it the context during parse phase...
Great projects!! Possibility to handle events?
If you want I could help and contribute!