While messing with NativeView#undelegate I realized that it's only possible to undelegate using a selector when that selector matches exactly the string passed to delegate. It doesn't do matching or sub-selections.
Let's say you called view.delegate('click', '*') and then tried to view.undelegate('click', 'div'). Or view.delegate('click', 'h1, div'), or any sub-selector. Since the strings don't match, we wouldn't be able to undelegate for you. Selector strings don't work that way.
I'm tempted to say "screw it". Undelegating isn't that common of a use case. We'd have to implement the better part of Sizzle to get this behavior (or call matches over a querySelectorAll ElementList). Is it worth solving?
While messing with
NativeView#undelegateI realized that it's only possible to undelegate using a selector when that selector matches exactly the string passed todelegate. It doesn't do matching or sub-selections.Let's say you called
view.delegate('click', '*')and then tried toview.undelegate('click', 'div'). Orview.delegate('click', 'h1, div'), or any sub-selector. Since the strings don't match, we wouldn't be able to undelegate for you. Selector strings don't work that way.I'm tempted to say "screw it". Undelegating isn't that common of a use case. We'd have to implement the better part of Sizzle to get this behavior (or call
matchesover aquerySelectorAllElementList). Is it worth solving?