Re: [selectors] Specificity of :nth-child() and :nth-last-child() with a selector list

On Friday 2014-10-31 12:38 -0700, Benjamin Poulain wrote:
> Currently, :nth-child(An+B of selector) has the same specificity has :nth-child() (0, 1, 0).
> 
> Given the new definition of :nth-child(An+B of selector) must match selector on the current element, I believe it would make sense to include the specificity of the nested selector in the specificity of :nth-child() and :nth-last-child().
> 
> For example:
>  :nth-child(odd of #WebKit)
> would have (1, 1, 0).

It largely seems reasonable to me.  Presumably it would work like
the specificity of :matches() as described in
http://dev.w3.org/csswg/selectors/#specificity

Though it's a little bit interesting that:

  :nth-child(odd of p, .byline)

would have specificity (0, 2, 0) for the #byline and (0, 1, 1) for
the p.  I guess that's probably ok, though.

-David


-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Friday, 31 October 2014 19:52:13 UTC