Skip to content
Permalink
Browse files

Make sure that undefined is always returned for missing data properti…

…es. Follow-up to #6304.
  • Loading branch information
jeresig committed Sep 24, 2010
1 parent 76db8a9 commit 515efbdc7119aa79de710144effe18413d4cb14a
Showing with 4 additions and 1 deletion.
  1. +4 −1 test/unit/data.js
@@ -81,11 +81,14 @@ test("jQuery.data", function() {
});

test(".data()", function() {
expect(2);
expect(4);

var div = jQuery("#foo");
strictEqual( div.data("foo"), undefined, "Make sure that missing result is undefined" );

div.data("test", "success");
same( div.data(), {test: "success"}, "data() get the entire data object" );
strictEqual( div.data("foo"), undefined, "Make sure that missing result is still undefined" );

var nodiv = jQuery("#unfound");
equals( nodiv.data(), null, "data() on empty set returns null" );

0 comments on commit 515efbd

Please sign in to comment.
You can’t perform that action at this time.