Skip to main content

Bug Tracker

Side navigation

#13619 closed feature (duplicate)

Opened March 17, 2013 12:18PM UTC

Closed March 18, 2013 04:35PM UTC

Adding a event to the begging of event stack

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0b2
Keywords: Cc:
Blocked by: Blocking:

being able to bind events that get placed at the beginning of the event stack.

i made a quick mod to the events to get the desired behaviour, and might be good to put in.

example 1 :: normal event order

var t = $('<div/>');

t.on('test', function(){console.log('FIRST');});

t.on('test', function(e){ e.stopImmediatePropagation(); console.log('last');});




example 2 :: adding a event before the others

var t = $('<div/>');

t.on('test', function(){console.log('FIRST');});

t.on('~test', function(e){ e.stopImmediatePropagation(); console.log('last');});




in events:add


type = ( selector ? special.delegateType : special.bindType ) || type;


var placeFirst = type[0] === '~';


type = type.substr(1);



handlers.push( handleObj );



handlers.unshift( handleObj );


handlers.push( handleObj );


Attachments (0)
Change History (2)

Changed March 18, 2013 04:18PM UTC by timmywil comment:1

owner: →
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: Open the link and click to "Fork" (in the top menu) to get started.

Changed March 18, 2013 04:35PM UTC by timmywil comment:2

resolution: → duplicate
status: pendingclosed

Duplicate of #7548.Sorry, I didn't read this closely. I just saw the pasted code and asked for a test case. However, this is not something that will be added to core.