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: |
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:
Also in the attachment.
Attachments (1)
Change History (4)
Changed February 11, 2010 08:07PM UTC by comment:1
Changed February 11, 2010 08:10PM UTC by comment:2
So, It works if I use .data(<property>, <value>) variant.
Exmaple is here: http://jsfiddle.net/ey7eY/
Changed February 11, 2010 08:11PM UTC by comment:3
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.
Changed February 11, 2010 08:30PM UTC by 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.
And If I add .data() after 3 event bindings, than no events are triggered at all.
Example is here: http://jsfiddle.net/TURXC/