#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: |
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 (1)
Change History (5)
Changed 13 years ago by
Attachment: | dataBugExample.js added |
---|
comment:1 Changed 13 years ago by
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
So, It works if I use .data(<property>, <value>) variant. Exmaple is here: http://jsfiddle.net/ey7eY/
comment:3 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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
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.
Sample reproduction of bug