If I assign a function to a variable foo, is there a way to select all elements that do not have a binding to foo given that they are assigned via a structure like $('.elementsWithClass').click(foo)?
My motivation here is we have ajax requests replacing parts of the DOM, and I need an easy way to rebind event handlers that is not based on .live/.on as we are controlling event bubbling in some parts of the application.
Regarding the motivation for doing this, since they are assigned with
$(".elementsWithClass").click(foo), you should just reselect them after the DOM has been updated.Since they need to be rebound, that must mean they’ve been replaced, which means it won’t do any good to select them based on if they have a handler.