Bug Tracker

Opened 6 years ago

Closed 6 years ago

#13426 closed bug (notabug)

Strange behavior in jQuery's .data method.

Reported by: chrisgravel@… Owned by: chrisgravel@…
Priority: undecided Milestone: None
Component: data Version: 2.0b1
Keywords: Cc:
Blocked by: Blocking:

Description

I have described and displayed the bug in a jsFiddle as requested. It is well commented so I don't need to put too much detail here.

http://jsfiddle.net/crislivinitup/mKYKe/4/

Just a small bug, I still like jQuery. :)

Change History (2)

comment:1 Changed 6 years ago by dmethvin

Owner: set to chrisgravel@…
Status: newpending

Can you please update your test case to only pass DOM elements to jQuery.data as documented? If there are still issues we can go from there.

http://api.jquery.com/jQuery.data/

comment:2 Changed 6 years ago by gibson042

Component: unfileddata
Resolution: notabug
Status: pendingclosed

You seem to be confusing the jQuery.data utility for the .data instance method. The former expects a DOM element or (occasionally) plain object, and should not be passed a jQuery collection because it will have no effect on the referenced elements. In almost all cases you'll want to use the method, as on lines 39 and 40 of http://jsfiddle.net/crislivinitup/mKYKe/4/.

Note: See TracTickets for help on using tickets.