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 <[email protected]> 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 <[email protected]>:
>
>
>
> > 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 ?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to