Skip to main content

Bug Tracker

Side navigation

#11030 closed bug (worksforme)

Opened December 15, 2011 10:55AM UTC

Closed December 15, 2011 01:34PM UTC

Last modified December 15, 2011 10:06PM UTC

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

Reported by: Joaquim Rendeiro <q.rendeiro@gmail.com> 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.

Attachments (0)
Change History (2)

Changed December 15, 2011 01:34PM UTC by dmethvin comment:1

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/

Changed December 15, 2011 10:06PM UTC by Joaquim Rendeiro <q.rendeiro@gmail.com> comment:2

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