> I agree, do you think .sort() and .reverse() could be added to core jQuery
> object in the future, or should I just add a plugin.
Sort, reverse, and splice are definitely possible - maybe for the 1.1 release.
--John
___
jQuery mailing list
discuss@jq
Oops, I meant to make that:
jQuery.fn.unshift = jQuery.fn.add;
The issue is, however, that fundamentally .push() or .unshift() won't
work as expected, since adding an item to a jQuery object isn't like
adding a item to a normal array. The jQuery object is more like a
'Set' than it is a true 'Array
On 10/7/06, Michael Geary <[EMAIL PROTECTED]> wrote:
> > > jQuery.fn.reverse = function() {
> > >this.pushStack(this.get().reverse());
> > >return this;
> > > }
>
> > Nice. That is a better approach then just doing
> > jQuery.fn.reverse = [].reverse.
>
> I'm curious, what is the advantage o
> > jQuery.fn.reverse = function() {
> >this.pushStack(this.get().reverse());
> >return this;
> > }
> Nice. That is a better approach then just doing
> jQuery.fn.reverse = [].reverse.
I'm curious, what is the advantage of one approach over the other?
-Mike
> > From: Michael Geary
> >
> > Armed with this knowledge, one might be tempted to load
> > all the Array methods in one fell swoop:
> >
> >jQuery.fn.prototype = Array.prototype;
> >
> > But that does not work, presumably because jQuery is
> > already being a bit sneaky about its Array-like be
I agree, do you think .sort() and .reverse() could be added to core jQuery
object in the future, or should I just add a plugin.
--
View this message in context:
http://www.nabble.com/.each-backwards---tf2399145.html#a6694292
Sent from the JQuery mailing list archive at Nabble.com.
Hi John!
> jQuery.fn.unshift = jQuery.fn.unshift;
>
What is that supposed to do?
-- Jörn
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
> jQuery.fn.reverse = function() {
> this.pushStack(this.get().reverse());
> return this;
> }
Huh, at first I though that that code would infinitely recurse, I
totally forgot that .get() returns a "clean" array of elements - good
call! Just a quick simplification:
jQuery.fn.reverse = function()
kenton.simpson schrieb:
> Thanks for the Idea. This works
>
> jQuery.fn.reverse = function() {
> this.pushStack(this.get().reverse());
> return this;
> }
>
Nice. That is a better approach then just doing jQuery.fn.reverse =
[].reverse.
-- Jörn
__
Thanks for the Idea. This works
jQuery.fn.reverse = function() {
this.pushStack(this.get().reverse());
return this;
}
a long that thread a lot more resorting function may be useful.
--
View this message in context:
http://www.nabble.com/.each-backwards---tf2399145.html#a6693603
Sent from th
Michael Geary schrieb:
>> From: Dossy Shiobara
>>
>> I'm surprised there's no .reverse(). i.e.:
>>
>> $(collection).reverse().each(...)
>>
>
> Great idea!
>
> How about the world's smallest plugin:
>
>jQuery.fn.reverse = [].reverse;
>
That's some really great stuff! It took me some ti
> From: Dossy Shiobara
>
> I'm surprised there's no .reverse(). i.e.:
>
> $(collection).reverse().each(...)
Great idea!
How about the world's smallest plugin:
jQuery.fn.reverse = [].reverse;
Try it out at http://jquery.com/ by entering these lines into the FireBug
console:
jQuery.fn.
ff2,0 is up to js1.7
On 10/6/06, Matt Stith <[EMAIL PROTECTED]> wrote:
> i know js 1.2 does, but i think its only supported in ff 2.0
> currently... but dont quote me on that.
>
> On 10/6/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
> > interesting!
> >
> > When would length be undefined on an JQ object?
>
On 2006.10.06, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
> I propose hcae:
Oh, god no. I see the smiley so I'm guessing you're only kidding, but
before someone goes "yeah, that's a good idea ..."
> kenton.simpson wrote:
> > Is there a way to make .each walk backwards threw the element collect
i know js 1.2 does, but i think its only supported in ff 2.0
currently... but dont quote me on that.
On 10/6/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
> interesting!
>
> When would length be undefined on an JQ object?
>
> When I first saw the question, I thought of tail recursion, does JS
> deal well (o
interesting!
When would length be undefined on an JQ object?
When I first saw the question, I thought of tail recursion, does JS
deal well (optimize) tail recursion?
On 10/6/06, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
> I propose hcae:
>
> jQuery.fn.hcae = function( fn, args ) {
> r
I propose hcae:
jQuery.fn.hcae = function( fn, args ) {
return jQuery.hcae( this, fn, args );
};
jQuery.hcae = function( obj, fn, args ) {
if ( obj.length == undefined )
for ( var i in obj )
fn.apply( obj[i], args || [i, obj[i]] );
e
17 matches
Mail list logo