On Apr 21, 1:45 am, Mark Gibson <[email protected]> wrote:
> It's generally considered very bad practice in the Javascript world to
> extend Object.prototype:http://erik.eae.net/archives/2005/06/06/22.13.54/
>
> Your best bet is to move your merge function elsewhere.
I think it is mostly "generally considered" bad practice by novice
developers. For example, the post you cite as your authority for that
statement claims doing so "breaks the object-as-hash-tables feature in
Javascript." It does not. Any JS developer with any experience knows
never to rely on for ( var pro in obj ) loops without using
hasOwnProperty() as well.
for ( var prop in obj ){
// this loops through inherited properties also;
// assuming this is not what you want, then you should add
if ( obj.hasOwnProperty(prop) ){
// do something to the property on this particular instance
}
}
Anyhow, you haven't really addressed the issue. I find it very
surprising, unnecessary, and inconvenient that jQuery invokes all
functions extended on all objects on the Window and Document objects
during loading. It is fragile to say "Oh, yeah, if you want to use
this library, make sure you don't use features X, Y, or Z of the core
programming language, because we're making inane assumptions." :)
Please fix it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---