To the defence of jQuery here, I don't think that would work. As I
understand, the purpose of aliasing those methods is to make the
jQuery object work transparently as an Array object when passed to
Sizzle.

All in all, this was not a lot of trouble for me. Luckily I worked out
pretty fast what was wrong (removing custom plugins to jQuery, of
course being a prudent course of action in debugging). I wish jQuery
some day can protect those methods better, but at least a notice to
other developers of plugins would be nice. Even though, point taken
from Daniel Friesen, I might think again before using method names
that are common in native objects the next time. nodeSort it is on
this occasion then :-)

-- Frode

On Feb 24, 12:42 pm, tres <[email protected]> wrote:
> Those 'internal' methods could also be prefixed with an underscore as
> an easy solution to avoid conflicts. It is considered by many in the
> PHP world as a convention and best-practice to prefix all protected
> and private members with an underscore.
>
> Just an idea.
>
> -Trey
>
> On Feb 24, 10:06 am, Robert Katić <[email protected]> wrote:
>
> > @John
> > jQuery uses some Sizzle internal details to gain some performance
> > enhancements.
> > If so, it is ok to me, but is it so much faster to pass jQuery empty
> > instance to Sizzle to avoid an $.fn.setArray call? I suppose that
> > array operations are pretty faster on Array instances.
>
> > On Feb 23, 10:24 pm, John Resig <[email protected]> wrote:
>
> > > Well, currently it is necessary. The jQuery object is treated like an
> > > array when it is passed in to the selector engine (and the selector
> > > results are push'd, sort'd, and splice'd on accordingly).
>
> > > It actually provided us with a decent speed-up, as well.
>
> > > --John
>
> > > On Mon, Feb 23, 2009 at 4:19 PM, prefect <[email protected]> 
> > > wrote:
>
> > > > I upgraded to jQuery 1.3.2 this evening, and was surprised by a weird
> > > > bug on a simple page in my application. The bug turned out to be due
> > > > to a conflict with a simple plugin I wrote for jQuery, which creates a
> > > > jQuery method called 'sort'. Apparently jQuery 1.3.2 aliases three
> > > > array methods onto the jQuery object, but is this really necessary?
> > > > The comments even say "for internal use only", so isn't there a way
> > > > you could do this without creating conflicts with external plugins?
>
> > > > This is regarding lines 282-286 in jQuery 1.3.2:
> > > > // For internal use only.
> > > > // Behaves like an Array's method, not like a jQuery method.
> > > > push: [].push,
> > > > sort: [].sort,
> > > > splice: [].splice,
>
> > > > --
> > > > Frode
--~--~---------~--~----~------------~-------~--~----~
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