W3C home > Mailing lists > Public > www-style@w3.org > March 2008

[css3-selectors] How do *-of-type selectors define the type?

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 7 Mar 2008 16:50:59 -0800
To: www-style@w3.org
Message-ID: <20080308005059.GA31930@ridley.dbaron.org>

After reading the text:
  # The :nth-of-type(an+b) pseudo-class notation represents an
  # element that has an+b-1 siblings with the same element name
  # before it in the document tree,
in http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#nth-of-type-pseudo
it is not clear to me what "the same element name" means.

http://www.w3.org/TR/2006/REC-xml-names-20060816/#concepts defines
three types of names.  Given the element:
  <html:p xmlns:html="http://www.w3.org/1999/xhtml" />
these names are:
  expanded name:  the pair of strings ("http://www.w3.org/1999/xhtml", "p")
  local name:     the string "p"
  qualified name: the string "html:p"

css3-selectors should define which of these three names are referred
to by the definitions of :nth-of-type() and :nth-last-of-type() (and
thus, by reference, :first-of-type, :last-of-type, and

I strongly prefer that it is the expanded name that matches.

I wrote a testcase at
http://dbaron.org/css/test/2008/of-type-selectors .  The only
implementation I could find that produced sensible results (Opera
9.5 beta) uses the expanded name (but doesn't support xmlns="").
Konqueror 3.5.9 seems to parse the testcase as HTML instead of
XHTML, and Safari 3.0.4 fails the control test and matches item (2)
(along with (1), (4), and (5)).


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Saturday, 8 March 2008 00:51:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:02 GMT