-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a function who checks if an event is binded #78
Comments
Interesting idea, given that it'd be fairly low code overhead this would probably be ok I guess. Would you mind outline what kind of use-case you'd have for this though? |
i'm interested in the use case too. from an application perspective, you should be able to use bean without thinking about that though. you should bind the event, and when the occasion arrises, bind the event again, and bean should be smart enough (already) to not add a duplicate event. |
welllll it just so happens that the dupe-detection feature was remove @ 1.0. See http://rod.vagg.org/2012/09/bean-v1/ - it was major suckage for performance and I made the decision that 1) it wasn't necessary for the vast majority code to justify the major overhead and 2) there may be legitimate reasons for adding the same handler more than once. soooo, a edited to remove poor humor |
Well, if you try to make a function cloneNode who copies all the children (with outerHTML or browser cloneNode), you'll see that thoses ways don't clone events. I tried bean.copy and it seemed to not to work or sth like that. So i added two function to your code : has and entries. entries returns the registry. Here is my code :
|
perhaps you should just be doing something like this: for (var i = 0; allSources.length; i++) {
bean.clone(allSources[i], allFinals[i])
} which should handle delegated events too and will just skip over elements that don't have events. I don't particularly want to leak the registry with an |
I tried bean.clone, but it didn't work, and i don't have enough time to debug sorry :/ |
Hey, first of all nice job !
I would like to know if it was possible to add a function wich would be called "has" and would check if a elem has a event. Something like :
If you want to do this, just add line > 540 :
and line 716 :
Note that it would be great if that function has could return true to something like that :
Thanks !
The text was updated successfully, but these errors were encountered: