Ticket #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: | |
| Blocking: | Blocked by: |
Description
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
Change History
Changed 3 years ago by soswow
-
attachment
dataBugExample.js
added
comment:1 Changed 3 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 3 years ago by soswow
So, It works if I use .data(<property>, <value>) variant. Exmaple is here: http://jsfiddle.net/ey7eY/
comment:3 Changed 3 years ago by john
- Status changed from new to closed
- Resolution set to invalid
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Sample reproduction of bug