Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#6074 closed bug (invalid)

.data() between event assignments makes bug in event order.

Reported by: soswow Owned by:
Priority: Milestone: 1.4.2
Component: event Version: 1.4.1
Keywords: data event order Cc:
Blocked by: Blocking:


When I add 3 event bindings one for another for some element (I used select box) everything works normally (1st, 2nd 3rd events triggered like it should). But When I add .data({}) between first and second event bindings, I get 4 event calls (2nd, 3rd, 2nd, 3rd)

You can see it in action here: http://jsfiddle.net/fcmW8/

Also in the attachment.

Attachments (1)

dataBugExample.js (1.1 KB) - added by soswow 13 years ago.
Sample reproduction of bug

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by soswow

Attachment: dataBugExample.js added

Sample reproduction of bug

comment:1 Changed 13 years ago by soswow

And If I add .data() after 3 event bindings, than no events are triggered at all. Example is here: http://jsfiddle.net/TURXC/

comment:2 Changed 13 years ago by soswow

So, It works if I use .data(<property>, <value>) variant. Exmaple is here: http://jsfiddle.net/ey7eY/

comment:3 Changed 13 years ago by john

Resolution: invalid
Status: newclosed

I think you mean to call .data("a", 1) or .data().a = 1; What you're doing right now is completely overwriting the existing data the existing in the object - including deleting the bound event handlers (which is causing everything to become corrupted). Please use one of the two other techniques.

comment:4 Changed 13 years ago by soswow

Oh, yeah. =( First bug report and so fail =( Sorry. I found this line "Note: Setting an element's data object with .data(obj) replaces all data previously stored with that element, including events that have been bound to the element." in api now ... oh.

Note: See TracTickets for help on using tickets.