[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread ricardobeat
Hi John, I liked them. If a jQuery object is "array-like", it makes sense to have the array methods, it's very convenient. And as slice() remains this seems inconsistent. I think this was a documentation problem more than anything - if anyone is going to create methods named to native ones, it b

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread John Resig
> Nice! And hopefully with no significant hit on performance? Not sure yet - haven't run the numbers, but there will be a hit. --John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To p

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread prefect
Nice! And hopefully with no significant hit on performance? -- Frode On Feb 25, 7:44 pm, John Resig wrote: > Ok, just to chime in again - I removed the sort/splice/push methods from > jQuery:http://dev.jquery.com/ticket/4250 > > I made sure that there was no longer a need for them in Sizzle. >

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread John Resig
Ok, just to chime in again - I removed the sort/splice/push methods from jQuery: http://dev.jquery.com/ticket/4250 I made sure that there was no longer a need for them in Sizzle. --John On Wed, Feb 25, 2009 at 1:42 PM, prefect wrote: > > You mean instead of Array.sort? Well, yes, because I'm n

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread prefect
You mean instead of Array.sort? Well, yes, because I'm not only interested in sorting DOM nodes in an array, I want to rearrange them in the DOM as well. So it's basically just a convenience plugin, wrapping Array.sort and performing the DOM rearrangements afterwards. My brief and cursory search o

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-25 Thread ricardobeat
Just to put my finger on the cake, is there any special reason you're using a custom plugin instead of the available sort() method? On Feb 24, 8:27 pm, prefect wrote: > To the defence of jQuery here, I don't think that would work. As I > understand, the purpose of aliasing those methods is to ma

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread prefect
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 wa

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread Sam Dutton
>> Hijacking a thread is even worse. << I know, I know... Humble apologies -- no intention to hijack the thread :-(. Sam On Tue, Feb 24, 2009 at 10:38 PM, Klaus Hartl wrote: > > On 24 Feb., 15:23, Sam Dutton wrote: > > Really sorry -- I replied to the group and forgot to change the subject >

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread Klaus Hartl
On 24 Feb., 15:23, Sam Dutton wrote: > Really sorry -- I replied to the group and forgot to change the subject > line. Hijacking a thread is even worse. --Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQu

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread Sam Dutton
Really sorry -- I replied to the group and forgot to change the subject line. Thanks for the link. Sam On Tue, Feb 24, 2009 at 2:18 PM, John Resig wrote: > > Umm - this seems to be pretty off-topic for the current thread. But > the Env.js stuff in jQuery core is very old at this point. > > I

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread John Resig
Umm - this seems to be pretty off-topic for the current thread. But the Env.js stuff in jQuery core is very old at this point. I recommend that you visit the Env.js google group: http://groups.google.com/group/envjs And grab the code from the current, active, fork: http://github.com/thatcher/env

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread Sam Dutton
I want to set up automated tests with QUnit as part of our build process (using Ant/Cruise) along the lines of this article: http://ejohn.org/projects/bringing-the-browser-to-the-server/. I've installed Rhino 1.7R1 and downloaded env.js from the above page. JavaScript code works as expected in th

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-24 Thread tres
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

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread Robert Katić
If I am not wrong, 'push', 'sort' and 'splice' functions are used only in Sizzle (before the jQuery obj returns to the user), so it would be safe to redefine those in plugins. Am I wrong? On Feb 23, 10:19 pm, prefect wrote: > I upgraded to jQuery 1.3.2 this evening, and was surprised by a weird

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread Robert Katić
@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,

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread Daniel Friesen
.nodeSort? ^_^ That's probably my favorite. jQuery primarily does dom, but don't forget that's actually not the only thing. $(array).map(...); $(array|object).each(...); $.ajax. Though ya, I can't track down any note about the .sort addition in the release notes. At least not anything one woul

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread prefect
I see. Well, obviously it's not much of a hassle for me to change the name of my plugin method. Would have been nice with a small mention of that in the release notes though, unless there's somewhere else more appropriate and easily available? It's kind of like introducing three new jQuery methods

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread Daniel Friesen
Personally, I'd avoid using any name in a plugin that is something people do on an array. It might make sense from your plugin's POV, but jQuery is meant to be an arrayish object, so you just cause ambiguity on whether you're doing array stuff or dom stuff. ~Daniel Friesen (Dantman, Nadir-Seen

[jquery-dev] Re: Aliasing of array methods in jQuery

2009-02-23 Thread John Resig
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,