mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #14101: $().data() should be undefined, not null
This commit is contained in:
parent
cc19a6bd3b
commit
30eee925db
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user