Selectors Level 3.14159

Editor's Draft 01 april 2010

This version:
Latest version:
Daniel Glazman (Disruptive Innovations SARL)
Arron Eicholz (Microsoft Corporation)


This draft describes the Level 3.14159 of Selectors, a mechanism describing elements in a given context in a document tree. This editor's draft extends the Selectors Level 3 specification with a new set of functional pseudo-classes.

Table of contents

1. Introduction

Selectors Level 1, Selectors Level 2 and Selectors Level 3 are defined as the subsets of selector functionality defined in the CSS1, CSS2.1 and Selectors specifications, respectively.

2. Selectors

The following table summarizes selectors that are new in Level 3.14159 and did not exist in Selectors Level 3:

Pattern Meaning Described in section First defined in CSS level
:nth-cousin() an E element, the n-th child of its parent having at least one non-empty sibling
Nth cousin
an E element, the n-th anonymous child of its parent
Nth illegitimate child 3.14159

In the case of CSS, the meaning of each selector is derived from the table above by prepending "matches" to the contents of each cell in the "Meaning" column.

3. Case sensitivity

All Selectors syntax is case-insensitive within the ASCII range (i.e. [a-z] and [A-Z] are equivalent), except for parts that are not under the control of Selectors. The case sensitivity of document language element names, attribute names, and attribute values in selectors depends on the document language. For example, in HTML, element names are case-insensitive, but in XML, they are case-sensitive.

4. Simple selectors

4.1. :nth-cousin() pseudo-class

The :nth-cousin(an+b) pseudo-class notation represents an element that has an+b-1 siblings before it in the document tree, for any positive integer or zero value of n, and has a parent element itself the sibling of at least one non-empty element. The an+b argument is defined by Section of Selectors Level3. This functional pseudo-class also accepts as argument the two values odd and even defined in Section of Selectors Level3.

4.2 :nth-illegitimate-child() pseudo-class

The :nth-illegitimate-child(an+b) pseudo-class notation represents an element that has an+b-1 siblings before it in the document tree, for any positive integer or zero value of n, and is the anonymous child of a parent element. An anonymous element is an element that does appear in the document tree but is not visible through the regular DOM [DOM-LEVEL-3-CORE] APIs like Node.firstChild or Node.nextSibling. As an example, an XBL [XBL2] binding can create anonymous elements.

5. Acknowledgements

The authors of this document would like to thank the Cupertino Inn at Cupertino, California, for its daily free drinks between 5pm and 7pm, an endless source of creativity.

6. Normative references

Daniel Glazman; et al. Selectors Level 3. 15 December 2010. W3C Proposed Recommendation. URL: http://www.w3.org/TR/2009/PR-css3-selectors-20091215/
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 8 September 2009. W3C Candidate Recommendation. (Work in progress.) URL: http://www.w3.org/TR/2009/CR-CSS2-20090908
Håkon Wium Lie; Bert Bos. Cascading Style Sheets (CSS1) Level 1 Specification. 11 April 2008. W3C Recommendation. URL: http://www.w3.org/TR/2008/REC-CSS1-20080411
Gavin Nicol; et al. Document Object Model (DOM) Level 3 Core Specification. 7 April 2004. W3C Recommendation. URL: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
Ian Hickson; XML Binding Language (XBL) 2.0. 16 march 2007. W3C Candidate Recommendation. URL: http://www.w3.org/TR/2007/CR-xbl-20070316/