Skip to main content

Bug Tracker

Side navigation

#4744 closed bug (invalid)

Opened June 10, 2009 09:07PM UTC

Closed June 16, 2009 01:24AM UTC

:even and :odd pseudoselectors work opposite the way one would expect

Reported by: kfrazier Owned by: john
Priority: minor Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: even, odd Cc:
Blocked by: Blocking:
Description

The :even and :odd pseudoselectors seem to select the opposite of what I would expect. I stepped through the code, and the apparent reason is that the jQuery code evaluates an element as even if its index within the jQuery object is evenly divisible by two. Since these indices begin at zero, the first, third, fifth and so on elements in the list (in natural counting order, beginning with one) are considered even. I would consider this a bug, since I think it is the opposite behavior from what most people would expect.

Attachments (0)
Change History (1)

Changed June 16, 2009 01:24AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

Even if it's the opposite of what you might expect, it's been documented to work that way for several years. No doubt there is a lot of code that has been written that would be broken if it was changed.

http://docs.jquery.com/Selectors/even

http://docs.jquery.com/Selectors/odd