On Nov 2, 1:28 am, John Resig <jere...@gmail.com> wrote:
> This changed slightly in the latest nightlies - if you do $(0) it'll
> be as if you did $() or $([]). As of now any false-ish value will give
> you an empty jQuery set.
>
> Considering that there is no intended behavior for passing in a number
> to the jQuery object this seems fine to me.
>
> I'm curious - why were you passing in a number to the jQuery object? I
> could sort of, kind of, understand passing in an array of values - but
> just one number doesn't make sense.
It was an array of values, but that array could also be a number,
which was then converted into an array, except for the 0 case.
This is bad form, relying on undocumented behaviour. I have since
fixed my code, but still curious.
Principle of least surprise says that $(1) and $(0) should be
consistent. To match the nightlies, perhaps $(1) should be an empty
jQuery object?

> Did you find this by accident, or are you writing code that depends on
> $(2) returning 2?
By accident, found that $(2) returns [2], so using it as a conversion
(though no longer, as above)

Xavier

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to