-
Notifications
You must be signed in to change notification settings - Fork 99
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
Recursive Unbind #29
Comments
What's the use case? If we implement this, it's going to be a bit expensive, it'll require to traverse from every registered node upto the parent. Better avoid it if it does not add much value. |
My use case is a less error-prone way of removing all handlers from the entire I didn't think traversing would be necessary. Wouldn't it be possible to iterate over the My thinking is that in order to remove handlers from all (or a subset) of the DOM you need to keep track of the state of your handlers. Arrive is already keeping track of the state of your handlers so you shouldn't have to keep track of it separately. I guess another idea would be to just expose the state with a separate method like: $('body').getArriveHandlers()
[<div class='.test-elem'></div>, <div class='.another-test-elem'></div>] One could then iterate over them to remove them, but that method may have broader applications as well. |
Oh, I didn't carefully read your comment.
You're saying that even iterating over the |
It seems like it would depend on the application whether the tradeoff is worth it -- the one-time cost of this traversal vs the cost of lingering handlers. |
The one time cost is not much big of an issue here. The point that concerns me most is that if the use cases are common enough? Just don't want to add feature that are not used enough (they just increase size of library and don't add much value). I use the library often but never felt the need for this. Lets see if someone is looking for the same feature. |
I think we don't need to traverse, the matches function will serve the purpose. We already have a helper method for it |
Hmm...no. It isn't useful in this case, we don't have a selector to match it against :) |
Agreed. |
This is a proposal for an
unbindArrive
option:which would remove all bindings to
document
and it's children (meeting the selector/handler criteria).The text was updated successfully, but these errors were encountered: