Bug Tracker

Opened 7 years ago

Closed 7 years ago

#6692 closed enhancement (fixed)

.data(object) should extend the current settings not replace them.

Reported by: ashays Owned by:
Priority: Milestone: 1.4.3
Component: data Version: 1.4.2
Keywords: data Cc:
Blocked by: Blocking:

Description

Unless there's some logical reason as to why this can't happen, I think it would be best if calling $(selector).data(object) would extend the current set of data. That is, if I were to say: var data = {a:1, b:2, d:3}; $("#id").data("a", "apple")

.data("b", "banana") .data("c", "codfish") .data(data) .data();

The return would be {a:1, b:2, c: "codfish", d:3};

Change History (2)

comment:1 Changed 7 years ago by dmethvin

Agreed. That would also solve the problem of accidentally clobbering some other plugin's data -- unless you used the same name, of course.

comment:2 Changed 7 years ago by john

Milestone: 1.51.4.3
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.