Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12073 closed bug (duplicate)

Triggering an event calls the method with the same name as the event type

Reported by: brian@… 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

Change History (2)

comment:1 Changed 7 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Yep, as documented. And if you don't want it to do that? Read the documentation for the answer. http://api.jquery.com/trigger/

comment:2 Changed 7 years ago by dmethvin

Duplicate of #10907.

Note: See TracTickets for help on using tickets.