Mistyped:

eq: function( i ) {
    var el = [ this[ i<0 ? i+this.length : i] ];
    if (el[0] === undefined) el.length = 0;
    return this.pushStack( el, 'eq', i );
};

It doesn't seem possible to pass the undefined object along. Anyone
doing that? $(undefined) and $(null) are also unsupported.

- ricardo

On Mar 3, 5:47 pm, Robert Katić <[email protected]> wrote:
> > jQuery([undefined])[0] === jQuery([])[0]
>
> Yes, but
>
>     jQuery([undefined]).length !== jQuery([]).length
>
> > eq() always returns a single element, so you'd only need to allow null/
> > NaN/""/etc to pass through, I guess:
>
> In the current implementation, eq(i) returns the value (not only
> nodes) at index i, if i is not out of range.
> In case of "out of range" it returns an "empty" jquery.
>
> > eq: function( i ) {
> >     var el = [ this[ i<0 ? i+this.length : i] ];
> >     if (el === undefined) el = [];
> >     return this.pushStack( el, 'eq', i )
>
> > }
>
> Your solution will return "jQuery([undefined])" in case of "out of
> range" insted of an "jQuery([])",
> and el will always be an array, so (el === undefined) will never be
> true.
--~--~---------~--~----~------------~-------~--~----~
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