Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9146 closed bug (duplicate)

jQuery( jsObject ).trigger() executes object methods

Reported by: Akania Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

Egz:

var myobject = {

someStuff : function(){ console.log('method someStuff'); }

}; jQuery(myobject).trigger('someStuff')

trigger('someStuff') causes execution of myobject 'someStuff' method. I don't know what to think about it - for me it is a bug. I tried to implement non-DOM custom events using bind & trigger. after giving one of events and one of object methods same name i've noticed this strange behaviour.

Does jQuery doesn't provide mechanism for creating custom non-DOM events?

Change History (3)

comment:1 Changed 7 years ago by Akania

http://jsfiddle.net/akania/DyEze/

Using triggerHandler() fix this behaviour.

comment:2 Changed 7 years ago by Rick Waldron

Component: unfiledevent
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

comment:3 Changed 7 years ago by Rick Waldron

Duplicate of #7930.

Note: See TracTickets for help on using tickets.