- From: Elika Etemad via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 23 Mar 2011 22:31:50 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/selectors4 In directory hutz:/tmp/cvs-serv7959 Modified Files: Overview.src.html Log Message: More minor reshuffling. Add subject indicator per Daniel's old old old proposal. Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/selectors4/Overview.src.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Overview.src.html 23 Mar 2011 22:08:10 -0000 1.3 +++ Overview.src.html 23 Mar 2011 22:31:48 -0000 1.4 @@ -413,22 +413,25 @@ prepending "matches" to the contents of each cell in the "Meaning" column.</p> -<h2 id=structure> -Selector Syntax and Structure</h2> +<h2 id=syntax> +Selector Syntax</h2> + +<h3 id=structure> +Structure and Terminology</h2> <p>A <dfn>selector</dfn> is a chain of one or more <a href="#compound">compound selectors</a> separated by <a href="#combinators">combinators</a>.</p> <p>A <dfn><a name=compound>compound selector</a></dfn> - is a chain of <a href="#simple-selectors-dfn">simple selectors</a> + is a chain of <a href="#simple">simple selectors</a> that are not separated by a <a href="#combinators">combinator</a>. It always begins with a <a href="#type-selectors">type selector</a> or a - <a href="#universal-selector">universal selector</a>. No other type - selector or universal selector is allowed in the sequence.</p> + (possibly implied) <a href="#universal-selector">universal selector</a>. + No other type selector or universal selector is allowed in the sequence.</p> <p>A <dfn><a name=simple-selectors-dfn></a><a - href="#simple-selectors">simple selector</a></dfn> is either a <a + href="#simple">simple selector</a></dfn> is either a <a href="#type-selectors">type selector</a>, <a href="#universal-selector">universal selector</a>, <a href="#attribute-selectors">attribute selector</a>, <a @@ -436,27 +439,48 @@ href="#id-selectors">ID selector</a>, or <a href="#pseudo-classes">pseudo-class</a>.</p> - <p><dfn>Combinators</dfn> are: whitespace, "greater-than + <p><dfn>Combinators</dfn> are punctuation that represent a particular + kind of relationship between the compound selectors on either side. + Combinators in Selectors level 4 include: whitespace, "greater-than sign" (U+003E, <code>></code>), "plus sign" (U+002B, - <code>+</code>) and "tilde" (U+007E, <code>~</code>). White - space may appear between a combinator and the simple selectors around - it. <a name=whitespace></a>Only the characters "space" (U+0020), "tab" - (U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form - feed" (U+000C) can occur in whitespace. Other space-like characters, - such as "em-space" (U+2003) and "ideographic space" (U+3000), are - never part of whitespace.</p> - - <p>The elements of a document tree that are represented by a selector - are the <dfn><a name=subject></a>subjects of the selector</dfn>. A - selector consisting of a single compound selector - represents any element satisfying its requirements. Prepending another - compound selector and a combinator to a sequence imposes - additional matching constraints, so the subjects of a selector are - always a subset of the elements represented by the last compound selector.</p> + <code>+</code>) and "tilde" (U+007E, <code>~</code>). + <a href="#whitespace">White space</a> may appear between a combinator + and the simple selectors around it.</p> <p>An empty selector, containing no compound selector, is an <a href="#invalid">invalid selector</a>.</p> +<h3 id=subject> +Subject of a Selector + + <p>The elements of a document tree that are represented by a selector + are the <dfn>subjects</dfn> of the selector. + + <p>By default, the subjects of a selector are the elements represented + by the last compound selector in the selector. Thus a selector consisting + of a single compound selector represents any element satisfying its + requirements. Prepending another compound selector and a combinator + to a sequence imposes additional matching constraints, so the subjects of + the selector are always a subset of the elements represented by the last + compound selector.</p> + + <p>The subject of the selector can be explicitly identified by prepending + an exclamation mark (!) to one of the compound selectors in a selector. + Although the element structure that the selector represents is the same + with or without the exclamation mark, indicating the subject in this way + can change which compound selector represents the subject in that structure. + + <div class="example"> + <p>For example, the following selector represents a list item <code>LI</code> + unique child of an ordered list <code>OL</code>: + <pre>OL > LI:only-child</pre> + <p>However the following one represents an ordered list <code>OL</code> + having a unique child, that child being a <code>LI</code>: + <pre>!OL > LI:only-child</pre> + <p>The structures represented by these two selectors are the same, but the + subjects of the selectors are not. + </div> + <h3 id=case-sensitive> Characters and case sensitivity</h3> @@ -469,6 +493,12 @@ case-sensitive. Case sensitivity of namespace prefixes is defined in [[!CSS3NAMESPACE]].</p> + <p><dfn id=whitespace>White space</dfn> in Selectors consists of the + characters SPACE (U+0020), TAB (U+0009), LINE FEED (U+000A), + CARRIAGE RETURN (U+000D), and FORM FEED (U+000C) can occur in whitespace. + Other space-like characters, such as EM SPACE (U+2003) and + IDEOGRAPHIC SPACE (U+3000), are never part of white space. + <p>Characters in Selectors can be escaped with a backslash according to the same <a href="http://www.w3.org/TR/CSS21/syndata.html#characters">escaping rules</a> as CSS. [[!CSS21]].</p>
Received on Wednesday, 23 March 2011 22:31:51 UTC