I am using jQuery 1.5 in my open source project, and the following line is also present in my own JavaScript code:
Object.prototype.isEmpty = function ()
{
if ( this.__count__ !== undefined )
{
return this.__count__ === 0 ? true : false;
}
for ( var property in this )
{
if ( this.hasOwnProperty(property) )
{
return false;
}
}
return true;
};
which simply extends Object.prototype by adding the isEmpty () method [which checks if the object is empty or not). Due to this addition, I get the error "c.replace is not function" in my Firebug console; and my research on the Internet led me to jQuery an error message where I “found out” that the Object.prototype extension not only breaks jQuery, but it is also a bad coding practice. My question is why?