On Aug 13, 2009, at 8:56 AM, John Resig wrote:

> :odd/:even aren't the same as using :nth-child() - you can't just  
> substitute one for the other. :odd/:even operate against the entire  
> result set whereas :nth-child() operates against the position of the  
> element in relation to its siblings.
>
> I'm not a big fan of making backwards-incompatible changes.
>
> --John

Totally agree with John here. Also, while :odd and :even may seem  
counter-intuitive in the abstract, when you consider that JavaScript  
(along with most other programming languages) is zero-based, it makes  
perfect sense. If you think about your table-row indexes starting at  
0, then it won't even seem so odd. ;-)

--Karl

> On Wed, Aug 12, 2009 at 11:26 PM, Andres Riofrio  
> <riofr...@gmail.com> wrote:
>
> When adding tablesorter to my site today, I came across a very  
> counter-
> intuitive behaviour of two of jQuery's selectors: ":odd" and ":even".
> While it is clearly documented that they do start counting at zero,
> there seems to be little reason (apart from backwards compatibility)
> to label odd elements as :even, and even elements as :odd.
> Furthermore, the ease of typing of :odd and :even instead of :nth- 
> child
> (*), make them the first choice of developers (such as tablesorter's),
> who might expect more straightforward behavior.
>
> I propose is to, in the next jQuery version, change the ":odd" and
> ":even" selectors so they behave exactly like :nth-child(odd)  
> and :nth-
> child(even), respectively. Alternatively, :odd and :even could be
> deprecated in favor of the :nth-child(*) selectors, so as to not break
> any existing code, but discouraging new developers from using the
> counter-intuitive selectors.
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@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