Re: Specificity: nth-of-type versus attribute selector?

On Sun, Jul 4, 2010 at 3:49 PM, Estelle Weyl <estelle@weyl.org> wrote:
> This issue I am having, however, is not with the :not or the :nth-of-type,
> it is with the selection order or process.

There is no ordering.  The meaning is the same whether you apply
:nth-of-type first, or the attribute selector first.  :nth-of-type
selects the nth element with a particular *element name*.  It will
select the nth <img>, or the nth <div>, or the nth <fooziblatz>
element.  It does not select "the nth element matching the rest of the
selector", or anything else.  Look at the definition in the spec:

"The :nth-of-type(an+b) pseudo-class notation represents an element
that has an+b-1 siblings with the same expanded element name before it
in the document tree, for any zero or positive integer value of n, and
has a parent element."
http://www.w3.org/TR/css3-selectors/#nth-of-type-pseudo

Note "with the same expanded element name".  Element names only, nothing else.

> I am looking for
> Of the image that have src*=photo, match the odd ones.

This is not doable with Selectors Level 3, as far as I can tell.

> Is this a correct browser rendering according to the specificiations?

Yes.

> I
> there a way to return first the attribute selector portion, then apply the
> nth-of-type pseudo class on top of that?

Logically, yes.  That's what you're doing.  It returns exactly the
same result as if you applied the selectors in the opposite direction,
however, because nth-of-type does not mean what you seem to think it
means.

Received on Sunday, 4 July 2010 19:58:18 UTC