Skip to main content

Bug Tracker

Side navigation

#8201 closed bug (invalid)

Opened February 07, 2011 05:49PM UTC

Closed February 07, 2011 08:24PM UTC

Last modified February 07, 2011 11:01PM UTC

the behavior of data api in jQuery 1.5 has changed

Reported by: yangjh02@gmail.com Owned by:
Priority: low Milestone: 1.next
Component: data Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

I use data api, to change my object, so that I can take advantage of changeData and setData event.

for example,

var customer = { name : "john" };

instead of change customer like

customer.name = "tim",

I use

$(customer).data("name", "tim");

so that I can use the event to handle the data change. In jQuery 1.4.4 , I can assert

customer.name == "tim",

but in 1.5, the behavior has change, it is now using the jQuery.cache object as like other objects,

here is a dump, of the customer.

Customer

1. jQuery1297093665961: 37

2. name: "john"

3. __proto__: Object

jQuery.Cache

1. 37: Object

1. name: "tim"

I am not sure reason of the change, but it break my code, possibly of many others. But the release note of 1.5 does not mention about the change, although, the change does pass the unit test, but it break user's expectation of the its side effect.

Attachments (0)
Change History (2)

Changed February 07, 2011 08:24PM UTC by snover comment:1

resolution: → invalid
status: newclosed

This is intentional. Please read the release notes.

Changed February 07, 2011 11:01PM UTC by jitter comment:2

component: unfileddata
priority: undecidedlow