Bug Tracker

Modify

Ticket #9146 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

jQuery( jsObject ).trigger() executes object methods

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

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

comment:1 Changed 2 years ago by Akania

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

Using triggerHandler() fix this behaviour.

comment:2 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to event

comment:3 Changed 2 years ago by rwaldron

Duplicate of #7930.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.