Skip to content
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

.on() / .off() should be rewritten to save all bound events #21

Open
itsrachelfish opened this issue Jul 23, 2015 · 0 comments
Open

.on() / .off() should be rewritten to save all bound events #21

itsrachelfish opened this issue Jul 23, 2015 · 0 comments

Comments

@itsrachelfish
Copy link
Member

Currently the only way to unbind an event is if the callback is passed to .off() specifically. If several functions need to be unbound, .off() would need to be called for each of them individually. Even worse, if the event callback is defined as an anonymous function there is no way to remove it.

It would be convenient if .on() stored all of the events being bound so they could later be unbound without passing a specific callback. For example:

$('.element').on('click', function()
{
    // This can't be removed!
});

// This would be convenient!
$('body').off();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant