I wouldn't call it a bug, i'd say its a non-obvious expected result.
If you wanted, you could add .between(x, y) that would be a handy shortcut.
John Resig wrote:
>> If p < 5 and p > 3, isn't p = 4?
>>
>> $("p:eq(4)") :)
>>
>> Otherwise, Klaus's option works:
>>
>> $("p:lt(5)").filter(":gt(3)")
>
> See, there's something of an issue surrounding this, though. I haven't
> decided if its a bug yet, or not. For example, assume the list:
>
> 1 2 3 4 5 6 7 8
>
> doing :lt(5) gives you
> 1 2 3 4
> then doing :gt(3) gives you
> 4
>
> However, doing :gt(3) first, gives you:
> 4 5 6 7 8
> then doing :lt(5) gives you
> 4 5 6 7
>
> The order is definitely important. Every time you do a "filter" (like
> eq or lt) it prunes the list down so all future operations must be
> relative to the previous operations (If that makes any sense).
>
> Additionally, I just recently added shortcut methods for eq/lt/gt so you can
> do:
>
> $("p").lt(5).gt(3)
>
> --John
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/