W3C home > Mailing lists > Public > www-style@w3.org > July 2010

Specificity: nth-of-type versus attribute selector?

From: Estelle Weyl <estelle@weyl.org>
Date: Sun, 4 Jul 2010 00:50:21 -0700
Message-Id: <F1FFED7C-AECE-436C-8562-D866706CF18F@weyl.org>
To: "www-style@w3.org CSS" <www-style@w3.org>
img[src*=photo]:nth-of-type(odd)

is selecting every odd image in the document, then checking to see if  
the attribute has the word photo.
Is that correct according to the spec?

I tried many configurations, including img[src*=photos]:nth-of- 
type(odd):not([src*=thumb])

No matter the source order, the first thing the browser selects is  
img:nth-of-type, before checking the attribute.

My assumption is that :nth-of-type, being a pseudo-class, has greater  
specificity than the attribute selector, but then shouldn't the :not  
pseudo have equal weight? I reversed the order, nothing seems to work.

The sandbox is here:

http://www.standardista.com/sandbox/selectors_test.html

Don't see in the specifications what order should take precedence. I  
think this is something that may need to be clarified.

-Estelle
http://www.standardista.com
Received on Sunday, 4 July 2010 07:50:34 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:29 GMT