One of the best peculiarity of jQuery is its way to be compatible with other libraries as well (or better, it is not pretending to be THE ONE in the script tag)
the for in loop is one of the most used one from every JS lib or snippet. Adding an hasOwnProperty to each for in loop destroys performances whose are considered a lot in every library/framework development. At the same time you should consider that everybody could apply to the Object.prototype his own hasOwnProperty method, to definitively break every other library that would try to be Object.prototype safe. As summary, Object.prototype should be untouched for these and other hundreds of reasons so big - for the proposal. Finally, DOM in IE does not inherits Object.prototype so since jQuery main purpose is to make DOM manipulation simple, I wonder which useless impact could have a couple of propetary Object.prototypes in the library. Regards On Tue, Feb 24, 2009 at 9: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 -~----------~----~----~----~------~----~------~--~---
