Skip to main content

Bug Tracker

Side navigation

#4532 closed bug (fixed)

Opened April 13, 2009 06:58PM UTC

Closed April 30, 2009 09:50PM UTC

Last modified November 20, 2010 02:41PM UTC

Live event handlers don't receive custom event data

Reported by: nbubna Owned by: brandon
Priority: major Milestone: 1.4
Component: event Version: 1.3.2
Keywords: live, event, data Cc:
Blocked by: Blocking:

$('.foo').live("foo", function(e, bar) {



$('.foo').trigger("foo", ['bar']);

Does not alert "bar". Instead, it alerts ".foo" or some such selector. The custom data gets squashed by the implementation. :( I can see where it happens, but i'm not sure how to fix it (yet).

Attachments (0)
Change History (6)

Changed April 13, 2009 07:29PM UTC by nbubna comment:2

Here's a very simple demo page:

Changed April 13, 2009 11:32PM UTC by nbubna comment:3

liveHandler is busted. it should look more like this:

function liveHandler( event ){
	var check = RegExp("(^|\\\\.)" + event.type + "(\\\\.|$)"),
		stop = true,
		elems = [];

	jQuery.each(, "events").live || [], function(i, fn){
		if ( check.test(fn.type) ) {
			var elem = jQuery([0];
			if ( elem )
				elems.push({ elem: elem, fn: fn });

	elems.sort(function(a,b) {
		return, "closest") -, "closest");
	var args = arguments;
	jQuery.each(elems, function(){
		if ( this.fn.apply(this.elem, args) === false )
			return (stop = false);

	return stop;

The key part being that you apply the function with the arguments given to liveHandler, not with

Changed April 14, 2009 04:13PM UTC by dmethvin comment:4

component: unfilledevent
owner: → brandon

Changed April 30, 2009 09:50PM UTC by brandon comment:5

resolution: → fixed
status: newclosed

fixed in r6325

Changed November 20, 2010 02:41PM UTC by dmethvin comment:6

#5675 is a duplicate of this ticket.