mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Make .data(Object) extend the existing data object. Fixes #6692.
This commit is contained in:
@@ -25,7 +25,7 @@ test("expando", function(){
|
||||
});
|
||||
|
||||
test("jQuery.data", function() {
|
||||
expect(12);
|
||||
expect(13);
|
||||
var div = document.createElement("div");
|
||||
|
||||
ok( jQuery.data(div, "test") === undefined, "Check for no data exists" );
|
||||
@@ -47,9 +47,11 @@ test("jQuery.data", function() {
|
||||
jQuery.data(div, "test", null);
|
||||
ok( jQuery.data(div, "test") === null, "Check for null data");
|
||||
|
||||
jQuery.data(div, "test3", "orig");
|
||||
jQuery.data(div, { "test": "in", "test2": "in2" });
|
||||
equals( jQuery.data(div, "test"), "in", "Verify setting an object in data." );
|
||||
equals( jQuery.data(div, "test2"), "in2", "Verify setting an object in data." );
|
||||
equals( jQuery.data(div, "test3"), "orig", "Verify original not overwritten." );
|
||||
|
||||
var obj = {};
|
||||
jQuery.data( obj, "prop", true );
|
||||
@@ -61,7 +63,7 @@ test("jQuery.data", function() {
|
||||
});
|
||||
|
||||
test(".data()", function() {
|
||||
expect(1);
|
||||
expect(2);
|
||||
|
||||
var div = jQuery("#foo");
|
||||
div.data("test", "success");
|
||||
|
||||
Reference in New Issue
Block a user