Side navigation
#12073 closed bug (duplicate)
Opened July 12, 2012 07:14PM UTC
Closed July 12, 2012 07:19PM UTC
Last modified July 12, 2012 07:19PM UTC
Triggering an event calls the method with the same name as the event type
| Reported by: | brian@mellmo.com | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
Example:
var obj = {};
obj.cancel = function() {
$(obj).trigger('cancel');
};
obj.cancel();
This results in an infinite loop because triggering 'cancel' calls 'cancel' on itself (which re-triggers 'cancel'...).
Tested against 1.7.1 and 1.7.2
Yep, as documented. And if you don't want it to do that? Read the documentation for the answer. http://api.jquery.com/trigger/