Skip to main content

Bug Tracker

Side navigation

#6692 closed enhancement (fixed)

Opened June 18, 2010 03:08PM UTC

Closed September 22, 2010 03:53PM UTC

.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};

Attachments (0)
Change History (2)

Changed June 19, 2010 01:30PM UTC by dmethvin comment:1

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

Changed September 22, 2010 03:53PM UTC by john comment:2

milestone: 1.51.4.3
resolution: → fixed
status: newclosed