Diogo - Unfortunately I don't have a link to that original discussion - that took place long ago (likely early 2006).
This seems like a relevant post on the subject: http://peter.michaux.ca/articles/javascript-the-good-parts-built-in-object-augmentation-and-namespacing --John On Tue, Feb 24, 2009 at 9:23 PM, diogobaeder <[email protected]> wrote: > > John, > > Following this conversation, I remembered that someone told me that > jQuery was avoiding extending native objects since it's very > beginning, and there was a discussion about it involving you and other > developers... if you have, can you put a reference/link to that > discussion here, to read what were the opinions about it? There were > discussions about the same subject at my work place... > > Thanks! > > Diogo > > > > On Feb 24, 7:17 pm, John Resig <[email protected]> wrote: >> Umm... I think you may be confused. He's talking about the cases where >> some other code on a site modifies the Object.prototype (not jQuery - >> some other code). It's jQuery's responsibility to try and work in the >> most situations, regardless of the outside code (even if it's native >> code extensions, like we see in other libraries like Prototype and >> MooTools). >> >> jQuery is not - and will never - add code to a native object. >> >> --John >> >> On Tue, Feb 24, 2009 at 5:11 PM, Andrea Giammarchi >> >> <[email protected]> wrote: >> > So I guess I got everything wrong ... you are planning to implement >> > hasOwnProperty in every for in ... bad choice, imho, people do not need to >> > use Object.prototype when $.each(o) instead of o.each() is basically the >> > same number of characters/speed. >> >> > Code elegance to ruin performances? >> >> > On Tue, Feb 24, 2009 at 9:45 PM, John Resig <[email protected]> wrote: >> >> >> Marcus - >> >> >> This is the current ticket that I'm tracking on the issue: >> >>http://dev.jquery.com/ticket/2721 >> >> >> I currently have it on the 1.4 roadmap - but if you already have a >> >> patch, I would love to see it (please attach it to the above ticket, >> >> as well) - perhaps we can get something landed sooner, rather than >> >> later. >> >> >> --John >> >> >> On Tue, Feb 24, 2009 at 4:04 PM, Marcus Pope <[email protected]> wrote: >> >> >> > Of the 4 total bugs found when searching for hasOwnProperty, each one >> >> > reports that jQuery doesn't support object prototype extensions >> >> > because of some factor. In the most recent case a bug was closed >> >> > invalid with the following explanation: >> >> >> > "jQuery does not support changes to Object.prototype. The additional >> >> > Object properties become visible to for-in loops and breaks any code >> >> > that uses them. " >> >> >> > After going through and editing the 30 or so references to unsafe >> >> > for..in loops I was able to compile my application which extensively >> >> > uses custom functions on the object prototype. I guess I'm confused >> >> > as to why this cannot (or will not) be integrated into the jquery >> >> > code. >> >> >> > I'll admit I'm not a jQuery expert, but I couldn't find any code using >> >> > inherited objects in the for..in iterations. Maybe it has something >> >> > to do with jquery pluggins. >> >> >> > Of course my solution is to modify the codebase every time a new >> >> > version is released, but this seems pointless if making the iterations >> >> > safe would resolve the problem altogether. >> >> >> > Just curious, any info welcome. >> >> >> > Thanks, >> >> > Marcus > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
