Commit 30eee925 authored by Corey Frang's avatar Corey Frang Committed by Rick Waldron

Fix #14101: $().data() should be undefined, not null

parent cc19a6bd
......@@ -75,8 +75,7 @@ jQuery.extend({
jQuery.fn.extend({
data: function( key, value ) {
var i, name,
data = null,
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
......
......@@ -170,6 +170,12 @@ test("jQuery.data(object/flash)", 25, function() {
dataTests( flash );
});
// attempting to access the data of an undefined jQuery element should be undefined
test("jQuery().data() === undefined (#14101)", 2, function() {
strictEqual(jQuery().data(), undefined);
strictEqual(jQuery().data("key"), undefined);
});
test(".data()", function() {
expect(5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment