Update jQuery.hasData to always return a boolean, with unit tests.
This commit is contained in:
parent
445fdf720c
commit
f5d4bf8920
2 changed files with 22 additions and 13 deletions
|
@ -22,7 +22,7 @@ jQuery.extend({
|
|||
},
|
||||
|
||||
hasData: function( elem ) {
|
||||
return !elem.nodeType || (elem[ jQuery.expando ] && !jQuery.isEmptyObject(jQuery.cache[ elem[jQuery.expando] ]));
|
||||
return !elem.nodeType || (!!elem[ jQuery.expando ] && !jQuery.isEmptyObject(jQuery.cache[ elem[jQuery.expando] ]));
|
||||
},
|
||||
|
||||
data: function( elem, name, data ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue