sparklemotion/nokogiri — pull request #886 by Mange (2013-04-09 08:09:55+00:00)
Title: Add support for an-b in nth selectors

Nokogiri's CSS parser does not support `an-b` in `nth-child` selectors. I've added support for them by converting the `-b` variable into its positive variant, according to the [W3C documentation](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo).

**W3C**:
> ```
> :nth-child(10n-1) /* represents the 9th, 19th, 29th, etc, element */
> :nth-child(10n+9) /* Same */
> ```

Renamed the node name from `:AN_PLUS_B` to `:NTH`, since that is the name W3C uses for their parser rule declaration.

---

My initial take tried to separate the parser rules more, with a `IDENT MINUS NUMBER` rule, but that didn't work since `IDENT` can take minus signs and numbers in them. I don't want to rewrite the entire parser to support one small special case inside `nth` specifications, where `n` is some special magic entity. If this is in error, I could try again, removing the use of `IDENT` for `N` or something similar.