@Andrea

Captains text is the best example why you are not supposed to say :
" ...  for people that use obtrusive code that changes the
Object.prototype..."

Faced with a javascript royal mess he inherited, Captain P.  trusted
that jQuery is the way to go. But now his trust is somewhat less
prominent...

Me or you or Captain P. we surely will not extend Object.prototype,
but still we need jQuery that will work in the presence of a code that
does this. We do not need to be talled that Object.prototype should
never be extended.

So jQ team, just go ahead and do it ;o) ... There are tons of legacy
javascript out there with Object.prototype abused comprehensively.
Right now none of it can be replaced with jjQuery.

--DBJ


On Apr 22, 2:30 pm, Andrea Giammarchi <andrea.giammar...@gmail.com>
wrote:
> I did not know a native hasOwnProperty method as boolean condition could
> cause so many troubles but I simply replied to Captain Palapa. It was not a
> suggestion for Sizzle, just a quick fix for people that use obtrusive code
> that changes the Object.prototype.
> But, obviously, if Sizzle uses for in everywhere, well ... that is just the
> top of the iceberg :-)
>
> Regards
>
>
>
> On Wed, Apr 22, 2009 at 2:14 PM, DBJDBJ <dbj...@gmail.com> wrote:
>
> > I tough of that, seemingly obvious ... but I think it has not
> > worketh ...
>
> > Also this will require a non trivial jQ+Sizzle refactoring. Lot of
> > testing, etc ... Me thinks ?
>
> > -- DBJ
>
> > On Apr 22, 9:01 am, Andrea Giammarchi <andrea.giammar...@gmail.com>
> > wrote:
> > > Have you tried this already?
>
> > > 1585:                    if (Expr.filter.hasOwnProperty(type) && (match =
> > > Expr.match[type].exec(expr)) !=
>
> > > > > > null) {
>
> > > Regards
>
> > > On Tue, Apr 21, 2009 at 10:02 PM, CaptainPalapa <captainpal...@gmail.com
> > >wrote:
>
> > > > Are there any solutions to this issue yet?  We're reworking our entire
> > > > framework that (prior to my arrival) was a mess of Prototype,
> > > > ColdFusion CFAjax stuff, Spry, you name it.  We're slowly replacing
> > > > other code with jQuery calls, but it's not going to be an overnight
> > > > process...and we still have to keep the existing site running.  The
> > > > noConflict() doesn't completely solve all our issues, but sure made a
> > > > big difference.
>
> > > > On Mar 28, 2:51 am, DBJDBJ <dbj...@gmail.com> wrote:
> > > > > First: Ok, I will not. It looks silly I know.
>
> > > > > Second + Third :
>
> > > > > -- I do never extend object prototype myself. But 50% of javascript
> > > > > users will. As soon as they find some "awesome" snippets on the net.
> > > > >    The point here is not what me and you (or unavoidable Daniel) know
> > > > > and do with jQ.
> > > > >    The point is what majority of jQuery customers do and will do.
> > > > >    My voluntary contribution is to point out what I think general
> > > > > jQuery public will experience, not us (aka "experts" ;o)
> > > > >    Same as my discusion about context logic: I know what it is and
> > how
> > > > > is it to be used etc. But at least 50% of jQuery customers will
> > either
> > > > > never ever
> > > > >    use the context in $() call or will use it but in a wrong way.
> > > > > Exactly the same is with Object.prototype.
> > > > >    So when real non expert jQuery customer (which is not me ;o) posts
> > > > > a finding,
> > > > >    the last thing I want you John (and Daniel ;o) to do is to say
> > > > > anything along the lines: "this is a wrong question to ask"..
> > > > >    And I do not want you to do this because I think jQuery is very
> > > > > good AND equaly importantly has good people "inside".
> > > > >    Also there is a small matter of  a typical jQ users blaming jQ for
> > > > > their inexperience. As I am sure you are experiencing every day.
> > > > >   There are already blogs where managrs complain how jQ enbaled
> >  pages
> > > > > are becoming slower etc.
> > > > >   Some of them also blog about their developers not using context or
> > > > > some other examples of bad Javascript and/or jQ usage.
> > > > >   But most of them do not blog about having bad web developers.
> > > > >   And that leaves bad impression (undeservedly) on jQ.
> > > > >   I think 90% of jQ users until few months ago have been
> > > > >   Web Designers who found out about   $("#mydiv").hide("slow").show
> > > > > ("slow") and got excited ;o)
> > > > >   With my findings , I just might to help deal with that kind of jQ
> > > > > users. Which are making, I am affraid, far more than 50% of jQ users
> > > > > population.
>
> > > > >   Enough of ranting ;o)
>
> > > > > It seems (obvious?) to me  jQuery.each () is where you arleady have
> > > > > solved the "extending Object.prototype"  problem, (as you already
> > > > > know)?
> > > > > Have length property and use it always, to iterate over jQ internal
> > > > > objects. Same as you do with jQ itself ...
>
> > > > > So, jq.1.3.2 line # 1584 becomes :
>
> > > > > 1584:                for (var type = 0; type <  Expr.filter.length;
> >  j+
> > > > > +) {
>
> > > > > ...
>
> > > > > On Mar 27, 6:30 pm, John Resig <jere...@gmail.com> wrote:
>
> > > > > > First, please don't use all-caps in your email subjects.
>
> > > > > > Second, Yes, this is known - and it's highly recommended that you
> > > > > > don't extend Object.prototype - it'll do far more than break
> > jQuery.
>
> > > > > > Third, it's something that we're looking into for the future, but
> > > > > > please don't do it, regardless of the state of jQuery.
>
> > > > > >http://erik.eae.net/archives/2005/06/06/22.13.54/
>
> > > > > > --John
>
> > > > > > 2009/3/27 DBJDBJ <dbj...@gmail.com>:
>
> > > > > > > I have found this:
>
> > > > > > > If I do this, in a global scope :
>
> > > > > > > Object.prototype.any_method = function () {}
>
> > > > > > > Then Sizzle fails.
>
> > > > > > > [ jQuery.1.3.2 (uncompressed) ]
>
> > > > > > > 1583:            while (expr && set.length) {
> > > > > > > 1584:                for (var type in Expr.filter) {
> > > > > > > 1585:                    if ((match =
> > Expr.match[type].exec(expr)) !=
> > > > > > > null) {
> > > > > > > 1586:                        var filter = Expr.filter[type],
> > found,
> > > > > > > item;
> > > > > > > 1587:                        anyFound = false;
> > > > > > > 1588:
> > > > > > > 1589:                        if (curLoop == result) {
> > > > > > > 1590:                            result = [];
> > > > > > > 1591:                        }
>
> > > > > > > Line 1585 , causes an exception "Object does not support this
> > > > property
> > > > > > > or method".
> > > > > > > This is because Expr.match[type].exec is "undefined", when type
> > ==
> > > > > > > any_method
> > > > > > > An it inevitably will become that because of the
> > > > > > > Object.protoype.any_method "extension" ...
>
> > > > > > > In the presence of jQuery (Sizzle) users should be able to add
> > > > methods
> > > > > > > to Object prototype, I think ?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to