Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#11030 closed bug (worksforme)

.trigger(event, extraParameters) does not pass extraParameters to the event handlers

Reported by: Joaquim Rendeiro <q.rendeiro@…> Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Versions affected: 1.7.0, 1.7.1 -- on() was only added in 1.7.0.

Browsers: only tested in Chrome (v15).

OS: only tested on Windows.

Issue: When using .trigger('eventName', additionalData), the additional data is not passed in e.data to the event handlers.

jsFiddle: http://jsfiddle.net/HN7q3/13/ -- expected: when clicking either link, their id is displayed, not 'undefined'.

The issue seems to be that jQuery.event.dispatch() only uses the data from the matched handlers, not the data received as argument.

Change History (2)

comment:1 Changed 8 years ago by dmethvin

Resolution: worksforme
Status: newclosed

As documented in the example at http://api.jquery.com/trigger/ , the data passed by .trigger() is in the extra arguments that come after the event.

http://jsfiddle.net/HN7q3/14/

comment:2 Changed 8 years ago by Joaquim Rendeiro <q.rendeiro@…>

Ok looks like I didn't read the docs thoroughly enough.. Sorry for wasting time.

Note: See TracTickets for help on using tickets.