Implementation feedback for :nth-child(An+B of selector)


I have added :nth-child(An+B of selector) to Webkit (for now as an experimental feature behind a flag but enabled by default in WebKit Nightly).

I have the following feedback:

1) Because of the definition (An+B-1 matching the selectorList), it is almost always necessary to repeat the selectors outside and inside :nth-child(). Most cases look something like:
    li[foo].bar:nth-child(2n+1 of li[foo].bar)

I personally like the power given by that definition but it is counter intuitive to write selectors with it. In my opinion, it would be beneficial to have one example covering this aspect in the specification.

2) Currently, the implementation generate a parsing error if pseudo elements are used within the nested selector list. The internal definition is the same as :not().
I believe this is the most useful definition for web developers as there is no added magic. Tab was in favor of silently ignoring pseudo elements. I would love to get more feedback on this.

3) The spec’s grammar does not cover :nth-child(An+B of selector). The current WebKit implementation make the selector list mandatory if the keyword “of” is present (e.g. :nth-child(2n of ) is invalid). The spec defines ":nth-child(An+B [of sel]?)” then say "If sel is omitted, it defaults to *.”.

Feedback is very much welcome on the implementation. :)


Received on Monday, 6 October 2014 19:28:40 UTC