Added some tweaks to $.type to handle null and undefined. Added a bunch of unit tests as well.
This commit is contained in:
parent
9ce1d09a0a
commit
5d2be7e299
2 changed files with 28 additions and 1 deletions
|
@ -446,7 +446,11 @@ jQuery.extend({
|
|||
},
|
||||
|
||||
type: function( obj ) {
|
||||
return toString.call(obj).slice(8, -1).toLowerCase();
|
||||
return obj === null ?
|
||||
"null" :
|
||||
obj === undefined ?
|
||||
"undefined" :
|
||||
toString.call(obj).slice(8, -1).toLowerCase();
|
||||
},
|
||||
|
||||
isPlainObject: function( obj ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue