I tried to prototype a length() method to Object and broke jQuery – how?

Posted by Barney on Stack Overflow See other posts from Stack Overflow or by Barney
Published on 2010-04-14T15:00:26Z Indexed on 2010/04/14 15:03 UTC
Read the original article Hit count: 205

Filed under:
|
|
|
|

I wrote the following:

Object.prototype.length = function(){
    var count = -1;
    for(var i in this) count++;
    return count;
}

It works. But when I execute my page, even without using this function, Firebug tells me that jQuery's .appendTo() is no longer a function. Why would this be?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about prototype