jquery/jquery — comment on commit 24e416dca36df4b182a612dba37f8b6cdaa25916
File:  line 0
By sebastien-p:

@dmethvin : The thing is that we can't control every third-party plugins that other people wrote which sometimes contain very bad code that can lead to, for example, memory leaks. That's why I (and some other guys as we can find some related questions on websites like stackoverflow) think that a `hasEvent` method could be useful. So, I wrote this plugin. Writing something like `elem.hasEvent("delegate!type.namespace") || elem.parents("selector").delegate("selector", "type.namespace", handler)` is - in my opinion - cleaner (but longer and slower, I know) than `elem.parents("selector").undelegate("selector", "type.namespace").delegate("selector", "type.namespace", handler)`. I agree that such a plugin is most of the time an overkill solution to the common problems we - as jQuery developers - face off. Anyway, I would love to see a better solution for both cases as part of a future jQuery API but, for now, I think that people who see any usefulness to those existing "hasEvent-like" plugins should be able to rely on them, don't they ?