fat / bean

an events api for javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't clone delegated events

benvinegar opened this issue · comments

Whenever you clone a delegated event, it becomes a regular event on the delegated element.

This test demonstrates the behaviour:

https://github.com/benvinegar/bean/commit/cd545996d53cbc5bcf3f745f46c6af72203e5166

The offending line is here: https://github.com/fat/bean/blob/master/src/bean.js#L493. You can see that when events are copied, the delegation properties are lost.

I spent about an hour trying to come up with a patch for this, but it's kind of nasty. Would appreciate some advice/help.

start off with a pull-requests for your test case, good to have that as a starting point, I'll have a look when I have a free moment.

Okay – see #57

OK, so tests are passing now, check out the current master & make before you use it. I'm not convinced by the solution, hence I'm not rolling a release out of it yet. It's starting to feel more and more hacky as I attach things to the internal handler functions, perhaps the registry is the best place for all of these properties instead. I'll have to ponder!

Looks good to me - or at least no worse than what's already there :) Thanks for tackling this so quickly.

Hah! That's right, __whatever is not usually a good sign; it had a whiff about it already and now the smell is just a bit stronger. I'll leave this issue open for now as a reminder.

I needed this, and the currentTarget fixes so decided to just clean up and release. Latest Bean in NPM has it done, will put a 'cleanup' for this code on the 0.5.0 wishlist.