isEmptyObject()

isEmptyObject()


I shall be so bold, to suggest slightly improved isEmptyObject() ...

/*
 currently in jQuery
 isEmptyObject : function(obj) {
            for (var name in obj) {
                return false;
            }
            return true;
        } ,
*/

/*
   return undefined on any object that is not "object" or "function"
   also ignore the possible prototype chain
*/
// slightly improved
isEmptyObject : function (object) {
    if (typeof object !== 'object' && typeof object !== 'function') return ;
        for (var name in object) {
            if (Object.prototype.hasOwnProperty.call(object,name)) {
                return false;
            }
        }
    return true;
};


--DBJ