Skip to content

Commit

Permalink
Added comments to isObject.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkatic authored and jeresig committed Nov 9, 2009
1 parent 76f6f0d commit c2bbcd8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core.js
Expand Up @@ -39,6 +39,7 @@ var jQuery = function( selector, context ) {

// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
indexOf = Array.prototype.indexOf;
Expand Down Expand Up @@ -323,7 +324,17 @@ jQuery.extend({
},

isObject: function( obj ) {
return this.constructor.call(obj) === Object;
if ( toString.call(obj) !== "[object Object]" ) {
return false;
}

//own properties are iterated firstly,
//so to speed up, we can test last one if it is own or not

var key;
for ( key in obj ) {}

return !key || hasOwnProperty.call( obj, key );
},

isEmptyObject: function( obj ) {
Expand Down

0 comments on commit c2bbcd8

Please sign in to comment.