I'm frustrated at the ambiguity of the CSS3 spec on this issue. See for yourself at (http://www.w3.org/TR/2001/CR-css3-selectors-20011113/ #nth-child-pseudo). The spec says that a and b "must be zero, negative integers or positive integers," but does not give any examples in which b is negative -- neither in the spec nor in the test suite.
Firstly: I can only assume that if b is negative the syntax is, for instance, (3n-2) instead of (3n+-2), as the latter would just be silly. Secondly: If I assume the same sort of logic for negative values of b as for positive values, then out of a group of 10 elements: (n-2) selects elements 1-8 (just like n+2 selects 2-10 and -n+2 selects 1-2) (3n-2) selects elements 1, 4, and 7 (the -2 value of b determines the modulus and also excludes the last two items in the collection) (n-9) selects element 1 Here's a pastebin of the rewritten logic. (http://pastie.caboo.se/ 47481) Note that the "total" argument specifies the length of the collection (so that it returns only indices that actually fall within the result set). Thoughts on either of these issues? Cheers, Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---