Skip to main content

Bug Tracker

Side navigation

#6074 closed bug (invalid)

Opened February 11, 2010 08:00PM UTC

Closed February 11, 2010 08:11PM UTC

Last modified February 11, 2010 08:30PM UTC

.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:

Also in the attachment.

Attachments (1)
  • dataBugExample.js (1.1 KB) - added by soswow February 11, 2010 08:03PM UTC.

    Sample reproduction of bug

Change History (4)

Changed February 11, 2010 08:07PM UTC by soswow comment:1

And If I add .data() after 3 event bindings, than no events are triggered at all.

Example is here:

Changed February 11, 2010 08:10PM UTC by soswow comment:2

So, It works if I use .data(<property>, <value>) variant.

Exmaple is here:

Changed February 11, 2010 08:11PM UTC by john comment:3

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.

Changed February 11, 2010 08:30PM UTC by soswow comment:4

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.