10 |
<div class="header"> |
<div class="header"> |
11 |
<h1>Selectors Serialization Format for Testing (<abbr>SSFT</abbr>) |
<h1>Selectors Serialization Format for Testing (<abbr>SSFT</abbr>) |
12 |
Specification</h1> |
Specification</h1> |
13 |
<h2>Working Draft <time datetime=2007-10-22>22 October 2007</time></h2> |
<h2>Working Draft <time datetime=2007-10-28>28 October 2007</time></h2> |
14 |
|
|
15 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
<dt>This Version</dt> |
98 |
<abbr>API</abbr></a> |
<abbr>API</abbr></a> |
99 |
<cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p> |
<cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p> |
100 |
|
|
101 |
<div class="issue ed">...</div> |
<p>It is so flexible language that a conceptually same pattern |
102 |
|
can be represented in inifnite numbers of instances of selectors. |
103 |
|
It might be convinient for e.g. validation of a test result to |
104 |
|
define a subset of the language, in which no semantically equivalent |
105 |
|
selectors are contained.</p> |
106 |
|
|
107 |
<p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The |
<p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The |
108 |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
115 |
<time datetime=2007-09-25>at the time of the writing</time>. |
<time datetime=2007-09-25>at the time of the writing</time>. |
116 |
Note that current Web browser implementations |
Note that current Web browser implementations |
117 |
of the <code>selectorText</code> attribute are consistently broken |
of the <code>selectorText</code> attribute are consistently broken |
118 |
in not escaping unsafe identifiers.</p> |
in not escaping unsafe identifiers and therefore it is not wise |
119 |
|
to deploy that format for testing.</p> |
120 |
|
|
121 |
</div> |
</div> |
122 |
|
|
133 |
2119</a> |
2119</a> |
134 |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
135 |
|
|
136 |
|
<p>Requirements phrased in the imperative as part of algorithms are to be |
137 |
|
interpreted with the meaning of the key word (<em class=rfc2119>MUST</em>) |
138 |
|
used in introducing the algorithm.</p> |
139 |
|
|
140 |
|
<p>Conformance requirements phrased as algorithms or specific steps |
141 |
|
<em class=rfc2119>MAY</em> be implemented in any manner, so long as the end |
142 |
|
result is equivalent.</p> |
143 |
|
|
144 |
<!-- Strictly speaking the paragraph below is not part of terminology. --> |
<!-- Strictly speaking the paragraph below is not part of terminology. --> |
145 |
<p>All examples and notes in this specification are non$B!>(Bnormative, |
<p>All examples and notes in this specification are non$B!>(Bnormative, |
146 |
as are all sections explicitly marked non$B!>(Bnormative. Everything |
as are all sections explicitly marked non$B!>(Bnormative. Everything |
153 |
</div> |
</div> |
154 |
|
|
155 |
<div class="section" id="serializing"> |
<div class="section" id="serializing"> |
156 |
<h2>Serializing Groups of Selectors</h2> |
<h2>Serializing Selectors in |
157 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
158 |
|
Representation</h2> |
159 |
|
|
160 |
|
<p>Subsections of this section define algorithms |
161 |
|
to <a href="#algorithm-serialize-a-simple-selector">serialize a simple |
162 |
|
selector</a> or <a href="#algorithm-serialize-a-group-of-selectors">serialize |
163 |
|
a group of selectors</a>.</p> |
164 |
|
|
165 |
<div class="issue ed"> |
<div class="issue ed"> |
166 |
<p><a href="http://suika.fam.cx/gate/cvs/*checkout*/markup/html/whatpm/Whatpm/CSS/SelectorsSerializer.pm">See the reference implementation</a> |
<p><a href="http://suika.fam.cx/gate/cvs/*checkout*/markup/html/whatpm/Whatpm/CSS/SelectorsSerializer.pm">See |
167 |
for now.</p> |
also the reference implementation</a> for now.</p> |
168 |
</div> |
</div> |
169 |
|
|
|
<p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
|
|
representation is defined for an invalid group of selectors.</p> |
|
|
|
|
170 |
<div class="note memo"> |
<div class="note memo"> |
171 |
<p>The serialized representation will not contain any comment.</p> |
<p>The serialized representation will not contain any comment.</p> |
172 |
</div> |
</div> |
|
|
|
173 |
<!-- TODO: link terms to Selectors --> |
<!-- TODO: link terms to Selectors --> |
174 |
|
|
175 |
<p>To |
<div class=section id=serializing-tokens> |
176 |
<dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize |
<h3>Serializing Tokens</h3> |
177 |
a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p> |
|
178 |
|
<p>To <dfn id=algorithm-normalize-an-ident title="normalize a string as an IDENT">normalize |
179 |
|
a string (<dfn id=var-n><var>n</var></dfn>) as an <code>IDENT</code></dfn>, |
180 |
|
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
181 |
<ol> |
<ol> |
182 |
<li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li> |
<li>If <var>n</var> is either an <code>IDENT</code> or a <code>HASH</code>, |
183 |
<li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in |
replace the escape sequences (<code>\</code> and following characters) in |
184 |
<var>gs</var>: |
<var>n</var> by characters represented by them respectively.</li> |
185 |
<ol> |
<li>If <var>n</var> is a <code>HASH</code>, remove the leading |
186 |
<li>If <var>selector</var> is <em>not</em> the first selector |
<code class=char>U+0023</code> <code class=charname>NUMBER SIGN</code> |
187 |
in the group of selectors, then append a <code class=char>U+002C</code> |
(<code class=char>#</code>) character from <var>n</var>.</li> |
188 |
<code class=charname>COMMA</code> (<code class=char>,</code>) followed by a |
<li>If there is any character that is <em>not</em> one of |
189 |
<a href="#newline">newline</a> to <var>result</var>.</li> |
<code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
190 |
<li>Append four <code class=char>U+0020</code> |
(<code class=char>-</code>), <code class=char>U+0030</code> |
191 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
<code class=charname>DIGIT ZERO</code> |
192 |
<li>Process each sequence of simple selectors or |
(<code class=char>0</code>) to <code class=char>U+0039</code> |
193 |
combinator in <var>selector</var> by following algorithm: |
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
194 |
<dl class=switch> |
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
195 |
<dt>If it is a sequence of simle selector |
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
196 |
(<dfn id=var-sss><var>sss</var></dfn>)</dt> |
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
197 |
<dd> |
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
198 |
<ol> |
(<code class=char>_</code>), <code class=char>U+0061</code> |
199 |
<li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize |
<code class=charname>LATIN SMALL LETTER A</code> |
200 |
each simple selector</a> in <var>sss</var>.</li> |
(<code class=char>a</code>) to <code class=char>U+006A</code> |
201 |
<li class=ed>sort</li> |
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
202 |
<li>Append a <a href="#newline">newline</a> to <var>result</var>.</li> |
<code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or |
203 |
</ol> |
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
204 |
</dd> |
<var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
205 |
<dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt> |
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
206 |
<dd> |
hexadecimal representation of the character. If the character |
207 |
<ol> |
is outside the range of <code>[<code class=char>U+0000</code>, |
208 |
<li>Append two <code class=char>U+0020</code> |
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
209 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li> |
210 |
<li> |
<li>If the first character in <var>n</var> is one of |
211 |
<dl class=switch> |
<code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code> |
212 |
<dt>If <var>c</var> is descendant combinator (white space)</dt> |
(<code class=char>0</code>) to <code class=char>U+0039</code> |
213 |
<dd>Append a <code class=char>U+0020</code> |
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
214 |
<code class=charname>SPACE</code> character to |
then prepend a string <code>\00003</code> at the beginning of |
215 |
<var>result</var>.</dd> |
<var>n</var>.</li> |
216 |
<dt>If <var>c</var> is child combinator |
<li>If the first character in <var>n</var> is <code class=char>U+002D</code> |
217 |
(<code class=char>></code>)</dt> |
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and |
218 |
<dd>Append a <code class=char>U+003E</code> |
the second character, if any, is <em>not</em> one of |
219 |
<code class=charname>GREATER-THAN SIGN</code> |
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
220 |
(<code class=char>></code>) character to <var>result</var>.</dd> |
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
221 |
<dt>If <var>c</var> is adjacent sibling combinator |
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
222 |
(<code class=char>+</code>)</dt> |
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
223 |
<dd>Append a <code class=char>U+002B</code> |
(<code class=char>_</code>), <code class=char>U+0061</code> |
224 |
<code class=charname>PLUS SIGN</code> (<code class=char>+</code>) |
<code class=charname>LATIN SMALL LETTER A</code> |
225 |
character to <var>result</var>.</dd> |
(<code class=char>a</code>) to <code class=char>U+006A</code> |
226 |
<dt>If <var>c</var> is general sibling combinator |
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
227 |
(<code class=char>~</code>)</dt> |
<code>U+0080</code> to <code>U+D7FF</code>, or |
228 |
<dd>Append a <code class=char>U+007E</code> |
<code>U+E000</code> to <code>U+10FFFF</code>, or |
229 |
<code class=charname>TILDE</code> (<code class=char>~</code>) |
<var>n</var> is equal to <code class=char>U+002D</code> |
230 |
character to <var>result</var>.</dd> |
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then |
231 |
</dl> |
replace the <code class=char>U+002D</code> |
232 |
</li> |
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) |
233 |
<li>Append a <code class=char>U+0020</code> |
character by string <code>\00002D</code>.</li> |
234 |
<code class=charname>SPACE</code> character to |
<li>Then, <var>n</var> is the result of the algorithm.</li> |
235 |
<var>result</var>.</li> |
</ol> |
236 |
</ol> |
|
237 |
</dd> |
<p>To <dfn id=algorithm-normalize-a-string title="normalize a string (STRING or IDENT) as a STRING">normalize |
238 |
</dl> |
a string (<dfn id=var-s><var>s</var></dfn>) as a <code>STRING</code></dfn>, |
239 |
</ol> |
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
240 |
</li> |
<ol> |
241 |
<li>Then, <var>result</var> is the |
<li>If <var>s</var> is either an <code>IDENT</code> or a |
242 |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
<code>STRING</code>, replace the escape sequences (<code>\</code> and |
243 |
representation of <var>gs</var>.</li> |
following characters) in <var>s</var> by characters represented by them |
244 |
|
(or an empty string if <code>\</code> is immediately followed by |
245 |
|
newline character(s)) respectively.</li> |
246 |
|
<li>If <var>s</var> is a <code>STRING</code>, remove the quotation marks |
247 |
|
enclosing <var>s</var>.</li> |
248 |
|
<li><p>If there is any character that is <em>not</em> one of |
249 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code>, |
250 |
|
<code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
251 |
|
(<code class=char>!</code>), <code class=char>U+0023</code> |
252 |
|
<code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to |
253 |
|
<code class=char>U+005B</code> <code class=charname>LEFT SQUARE |
254 |
|
BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT |
255 |
|
SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or |
256 |
|
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
257 |
|
<var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
258 |
|
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
259 |
|
hexadecimal representation of the character. If the character |
260 |
|
is outside the range of <code>[<code class=char>U+0000</code>, |
261 |
|
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
262 |
|
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</p></li> |
263 |
|
<li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
264 |
|
MARK</code> (<code class=char>"</code>) at the beginning of |
265 |
|
<var>s</var>.</p></li> |
266 |
|
<li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
267 |
|
MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</p></li> |
268 |
|
<li><p>Then, <var>s</var> is the result of the algorithm.</p></li> |
269 |
</ol> |
</ol> |
270 |
|
|
271 |
|
<p>A <dfn id=newline title=newline>newline</dfn> |
272 |
|
<em class=rfc2119>SHOULD</em> be represented as a |
273 |
|
<code class=char>U+000A</code> <code class=charname>LINE FEED</code> |
274 |
|
character. However, depending on the context where |
275 |
|
the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
276 |
|
representation is in use, a sequence of |
277 |
|
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
278 |
|
followed by a <code class=char>U+000A</code> |
279 |
|
<code class=charname>LINE FEED</code> (i.e. a |
280 |
|
<code>CRLF</code> sequence) or a character |
281 |
|
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
282 |
|
<em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead. |
283 |
|
<a href="#newline">Newline</a> representations |
284 |
|
<em class=rfc2119>SHOULD</em> be consistent in an |
285 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
286 |
|
representation.</p> |
287 |
|
|
288 |
|
<div class="note memo"> |
289 |
|
<p>Therefore, newlines must be normalized before |
290 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
291 |
|
representations are literally compared.</p> |
292 |
|
</div> |
293 |
|
|
294 |
|
<div class="issue ed"> |
295 |
|
<p>Need to define <dfn id=lower-case>lower$B!>(Bcase</dfn>. |
296 |
|
It is tr/A-Z/a-z/ for now.</p> |
297 |
|
</div> |
298 |
|
|
299 |
|
</div> |
300 |
|
|
301 |
|
|
302 |
|
<div class=section id=serializing-simple-selectors> |
303 |
|
<h3>Serializing Simple Selectors</h3> |
304 |
|
|
305 |
|
<p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
306 |
|
representation is defined for an invalid <a href="#simple-selector">simple |
307 |
|
selector</a>.</p> |
308 |
|
|
309 |
<p>To |
<p>To |
310 |
<dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize |
<dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize |
311 |
a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>:</p> |
a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>, |
312 |
|
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
313 |
|
<ol> |
314 |
|
<li>Let <dfn id=var-r><var>r</var></dfn> an empty string.</li> |
315 |
|
<li>Process <var>ss</var> as following: |
316 |
|
|
317 |
<dl class=switch> |
<dl class=switch> |
318 |
<dt>If <var>ss</var> is a type or universal selector</dt> |
<dt>If <var>ss</var> is a type or universal selector</dt> |
319 |
<dd> |
<dd> |
320 |
<ol> |
<ol> |
321 |
<li> |
<li>Append a namespace prefix as following: |
322 |
|
|
323 |
<dl class=switch> |
<dl class=switch> |
324 |
<dt>If a namespace URI is specified (via namespace prefix, or |
<dt>If a namespace URI is specified (via namespace prefix, or |
325 |
by omitting namespace prefix where a default namespace is specified)</dt> |
by omitting namespace prefix where a default namespace is specified)</dt> |
326 |
<dd class="ed">@@</dd> |
<dd>Append the namespace URI as a |
327 |
|
<a href="#algorithm-normalize-an-ident" title="normalize a string as an IDENT">normalized |
328 |
|
<code>IDENT</code></a> to <var>r</var>. Then, append a |
329 |
|
<code class=char>U+007C</code> |
330 |
|
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
331 |
|
character to <var>r</var>.</dd> |
332 |
<dt>If the null namespace is specified (by zero$B!>(Blength namespace |
<dt>If the null namespace is specified (by zero$B!>(Blength namespace |
333 |
prefix)</dt> |
prefix)</dt> |
334 |
<dd>Append a <code class=char>U+007C</code> |
<dd>Append a <code class=char>U+007C</code> |
335 |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
336 |
character to <var>result</var>.</dd> |
character to <var>r</var>.</dd> |
337 |
<dt>If no namespace is specified (by namespace prefix <code>*</code>, |
<dt>If no namespace is specified (by namespace prefix <code>*</code>, |
338 |
or by omitting namespace prefix where no default namespace is |
or by omitting namespace prefix where no default namespace is |
339 |
specified)</dt> |
specified)</dt> |
341 |
<code class=charname>ASTERISK</code> (<code class=char>*</code>) |
<code class=charname>ASTERISK</code> (<code class=char>*</code>) |
342 |
character, followed by a <code class=char>U+007C</code> |
character, followed by a <code class=char>U+007C</code> |
343 |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
344 |
character, to <var>result</var>.</dd> |
character, to <var>r</var>.</dd> |
345 |
</dl> |
</dl> |
346 |
</li> |
</li> |
347 |
<li>If <var>ss</var> is a type selector, append the |
<li>If <var>ss</var> is a type selector, append the |
348 |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
<a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) an IDENT">normalized</a> |
349 |
local name to <var>result</var>.</li> |
local name to <var>r</var>.</li> |
350 |
<li>If <var>ss</var> is a universal selector, append |
<li>If <var>ss</var> is a universal selector, append |
351 |
a <code class=char>U+002A</code> <code class=charname>ASTERISK</code> |
a <code class=char>U+002A</code> <code class=charname>ASTERISK</code> |
352 |
(<code class=char>*</code>) character to <var>result</var>.</li> |
(<code class=char>*</code>) character to <var>r</var>.</li> |
353 |
</ol> |
</ol> |
354 |
</dd> |
</dd> |
355 |
<dt>If <var>ss</var> is an attribute selector</dt> |
<dt>If <var>ss</var> is an attribute selector</dt> |
357 |
<ol> |
<ol> |
358 |
<li>Append a <code class=char>U+005B</code> <code class=charname>LEFT |
<li>Append a <code class=char>U+005B</code> <code class=charname>LEFT |
359 |
SQUARE BRACKET</code> (<code class=char>[</code>) to |
SQUARE BRACKET</code> (<code class=char>[</code>) to |
360 |
<var>result</var>.</li> |
<var>r</var>.</li> |
361 |
<li> |
<li> |
362 |
Append a namespace prefix as following: |
Append a namespace prefix as following: |
363 |
<dl> |
<dl> |
364 |
<dt>If a namespace URI is specified</dt> |
<dt>If a namespace URI is specified</dt> |
365 |
<dd class=ed>@@</dd> |
<dd>Append the namespace URI as a |
366 |
<dd class=ed>@@ Current reference implementation is wrong, |
<a href="#algorithm-normalize-an-ident" title="normalize a string as an IDENT">normalized |
367 |
since its result of sorting depends on namespace prefix.</dd> |
<code>IDENT</code></a> to <var>r</var>. Then, append a |
368 |
|
<code class=char>U+007C</code> |
369 |
|
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
370 |
|
character to <var>r</var>.</dd> |
371 |
<dt>If the null namespace is specified</dt> |
<dt>If the null namespace is specified</dt> |
372 |
<dd>Append a <code class=char>U+007C</code> |
<dd>Append a <code class=char>U+007C</code> |
373 |
<code class=charname>VERTICAL BAR</code> character to |
<code class=charname>VERTICAL BAR</code> character to |
374 |
<var>result</var>.</dd> |
<var>r</var>.</dd> |
375 |
<dt>If no namespace is specified</dt> |
<dt>If no namespace is specified</dt> |
376 |
<dd>Append a <code class=char>U+002A</code> |
<dd>Append a <code class=char>U+002A</code> |
377 |
<code class=charname>ASTERISK</code> (<code class=char>*</code>) |
<code class=charname>ASTERISK</code> (<code class=char>*</code>) |
378 |
character, followed by a <code class=char>U+007C</code> |
character, followed by a <code class=char>U+007C</code> |
379 |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
380 |
character, to <var>result</var>.</dd> |
character, to <var>r</var>.</dd> |
381 |
</dl> |
</dl> |
382 |
</li> |
</li> |
383 |
<li>Append the |
<li>Append the |
384 |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
<a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a> |
385 |
local name to <var>result</var>.</li> |
local name to <var>r</var>.</li> |
386 |
<li>If a value is specified in <var>ss</var>: |
<li>If a value is specified in <var>ss</var>: |
387 |
<ol> |
<ol> |
388 |
<li>Depending on the way to match, append <code>=</code>, |
<li>Depending on the way to match, append <code>=</code>, |
389 |
<code>~=</code>, <code>|=</code>, <code>^=</code>, |
<code>~=</code>, <code>|=</code>, <code>^=</code>, |
390 |
<code>$=</code>, or <code>*=</code> to <var>result</var>.</li> |
<code>$=</code>, or <code>*=</code> to <var>r</var>.</li> |
391 |
<li>Append the |
<li>Append the |
392 |
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
393 |
value to <var>result</var>.</li> |
value to <var>r</var>.</li> |
394 |
</ol> |
</ol> |
395 |
</li> |
</li> |
396 |
<li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT |
<li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT |
397 |
SQUARE BRACKET</code> (<code class=char>]</code>) to |
SQUARE BRACKET</code> (<code class=char>]</code>) to |
398 |
<var>result</var>.</li> |
<var>r</var>.</li> |
399 |
</ol> |
</ol> |
400 |
</dd> |
</dd> |
401 |
<dt>If <var>ss</var> is a class selector</dt> |
<dt>If <var>ss</var> is a class selector</dt> |
402 |
<dd>Append a <code class=char>U+002E</code> <code class=charname>FULL |
<dd>Append a <code class=char>U+002E</code> <code class=charname>FULL |
403 |
STOP</code> (<code class=char>.</code>) character, followed |
STOP</code> (<code class=char>.</code>) character, followed |
404 |
by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
by <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a> |
405 |
class name, <var>result</var>.</dd> |
class name, to <var>r</var>.</dd> |
406 |
<dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt> |
<dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt> |
407 |
<dd>Append a <code class=char>U+0023</code> <code class=charname>NUMBER |
<dd>Append a <code class=char>U+0023</code> <code class=charname>NUMBER |
408 |
SIGN</code> (<code class=char>#</code>) character, followed |
SIGN</code> (<code class=char>#</code>) character, followed |
409 |
by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
by <a href="#algorithm-normalize-an-ident" title="normalize a string (HASH except for the leading #) as an IDENT">normalized</a> |
410 |
<abbr>ID</abbr>, to <var>result</var>.</dd> |
<abbr>ID</abbr>, to <var>r</var>.</dd> |
411 |
<dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt> |
<dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt> |
412 |
<dd> |
<dd> |
413 |
<ol> |
<ol> |
414 |
<li>Append a <code class=char>U+003A</code> |
<li>Append a <code class=char>U+003A</code> |
415 |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
416 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
417 |
<li>Append the |
<li>Append the |
418 |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
<a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a> |
419 |
name of the pseudo$B!>(Bclass to <var>result</var>.</li> |
name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Bclass to |
420 |
|
<var>r</var>.</li> |
421 |
<li>Append any arguments as following: |
<li>Append any arguments as following: |
422 |
<dl class=switch> |
<dl class=switch> |
423 |
<dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt> |
<dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt> |
425 |
<ol> |
<ol> |
426 |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
427 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
428 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
429 |
<li>Append the |
<li>Append the |
430 |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
<a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a> |
431 |
language tag (the argument) to <var>result</var>.</li> |
language tag (the argument) to <var>r</var>. |
432 |
|
<span class="issue ed">Should we normalize cases?</span></li> |
433 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
434 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
435 |
(<code class=char>)</code>) character |
(<code class=char>)</code>) character |
436 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
437 |
</ol> |
</ol> |
438 |
</dd> |
</dd> |
439 |
<dt>If the name of the pseudo$B!>(Bclass is |
<dt>If the name of the pseudo$B!>(Bclass is |
442 |
<ol> |
<ol> |
443 |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
444 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
445 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
446 |
<li>Append the |
<li>Append the |
447 |
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
448 |
string (the argument) to <var>result</var>.</li> |
string (the argument) to <var>r</var>.</li> |
449 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
450 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
451 |
(<code class=char>)</code>) character |
(<code class=char>)</code>) character |
452 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
453 |
</ol> |
</ol> |
454 |
</dd> |
</dd> |
455 |
<dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>, |
<dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>, |
459 |
<ol> |
<ol> |
460 |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
<li>Append a <code class=char>U+0028</code> <code class=charname>LEFT |
461 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
462 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
463 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append <span class=ed>@@ normalized</span> |
464 |
integer <var>a</var> to <var>result</var>. |
integer <var>a</var> to <var>r</var>. |
465 |
If the argument is a keyword <code>odd</code> or <code>even</code>, |
If the argument is a keyword <code>odd</code> or <code>even</code>, |
466 |
<var>a</var> is <code>2</code>. If <var>a</var> and |
<var>a</var> is <code>2</code>. If <var>a</var> and |
467 |
<code>n</code> is omitted, <var>a</var> is assumed as |
<code>n</code> is omitted, <var>a</var> is assumed as |
472 |
character).</li> |
character).</li> |
473 |
<li>Append a <code class=char>U+006E</code> |
<li>Append a <code class=char>U+006E</code> |
474 |
<code class=charname>LATIN SMALL LETTER N</code> |
<code class=charname>LATIN SMALL LETTER N</code> |
475 |
(<code class=char>n</code>) character to <var>result</var>.</li> |
(<code class=char>n</code>) character to <var>r</var>.</li> |
476 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append <span class=ed>@@ normalized</span> |
477 |
integer <var>b</var> to <var>result</var>. |
integer <var>b</var> to <var>r</var>. |
478 |
It <em class=rfc2119>MUST</em> be preceded by a sign, |
It <em class=rfc2119>MUST</em> be preceded by a sign, |
479 |
either <code class=char>U+002B</code> <code class=charname>PLUS |
either <code class=char>U+002B</code> <code class=charname>PLUS |
480 |
SIGN</code> (<code class=char>+</code>) or |
SIGN</code> (<code class=char>+</code>) or |
491 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
492 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
493 |
(<code class=char>)</code>) character |
(<code class=char>)</code>) character |
494 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
495 |
</ol> |
</ol> |
496 |
</dd> |
</dd> |
497 |
<dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt> |
<dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt> |
505 |
<code class=charname>LATIN SMALL LETTER T</code>, and |
<code class=charname>LATIN SMALL LETTER T</code>, and |
506 |
<code class=char>U+0028</code> <code class=charname>LEFT |
<code class=char>U+0028</code> <code class=charname>LEFT |
507 |
PARENTHESIS</code> (<code>:not(</code>), followed by a |
PARENTHESIS</code> (<code>:not(</code>), followed by a |
508 |
<a href="#newline">newline</a>, to <var>result</var>.</li> |
<a href="#newline">newline</a>, to <var>r</var>.</li> |
509 |
<li>Append four <code class=char>U+0020</code> |
<li>Append four <code class=char>U+0020</code> |
510 |
<code class=charname>SPACE</code> characters to |
<code class=charname>SPACE</code> characters to |
511 |
<var>result</var>.</li> |
<var>r</var>.</li> |
512 |
<li>Append four <code class=char>U+0020</code> |
<li>Append four <code class=char>U+0020</code> |
513 |
<code class=charname>SPACE</code> characters to |
<code class=charname>SPACE</code> characters to |
514 |
<var>result</var> again.</li> |
<var>r</var> again.</li> |
515 |
<li><a href="#algorithm-serialize-a-simple-selector">Serialize |
<li><a href="#algorithm-serialize-a-simple-selector">Serialize |
516 |
the simple selector specified as the argument to the |
the simple selector specified as the argument to the |
517 |
<code>not</code> pseudo$B!>(Bclass</a>.</li> |
<code>not</code> pseudo$B!>(Bclass</a>.</li> |
518 |
<li>Append a <a href="#newline">newline</a> to |
<li>Append a <a href="#newline">newline</a> to |
519 |
<var>result</var>.</li> |
<var>r</var>.</li> |
520 |
<li>Append four <code class=char>U+0020</code> |
<li>Append four <code class=char>U+0020</code> |
521 |
<code class=charname>SPACE</code> characters to |
<code class=charname>SPACE</code> characters to |
522 |
<var>result</var>.</li> |
<var>r</var>.</li> |
523 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
524 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
525 |
(<code class=char>)</code>) character |
(<code class=char>)</code>) character |
526 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
527 |
</ol> |
</ol> |
528 |
</dd> |
</dd> |
529 |
|
<dt>Otherwise</dt> |
530 |
|
<dd>The pseudo$B!>(Bclass is not supported by this version of |
531 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
532 |
|
and therefore no |
533 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
534 |
|
representation is defined for <var>ss</var>. Stop the algorithm.</dd> |
535 |
</dl> |
</dl> |
536 |
</li> |
</li> |
537 |
</ol> |
</ol> |
541 |
<ol> |
<ol> |
542 |
<li>Append two <code class=char>U+003A</code> |
<li>Append two <code class=char>U+003A</code> |
543 |
<code class=charname>COLON</code> characters (<code>::</code>) |
<code class=charname>COLON</code> characters (<code>::</code>) |
544 |
to <var>result</var>.</li> |
to <var>r</var>.</li> |
545 |
<li>Append the |
<li>Append the |
546 |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
<a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a> |
547 |
name of the pseudo$B!>(Belement to <var>result</var>.</li> |
name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Belement |
548 |
<!-- For future version: append "(", arguments, ")", if any. --> |
to <var>r</var>.</li> |
549 |
|
<li>If the pseudo$B!>(Belement has any arguments: |
550 |
|
The pseudo$B!>(Belement is not supported by this version of |
551 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
552 |
|
and therefore no |
553 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
554 |
|
representation is defined for <var>ss</var>. Stop the algorithm. |
555 |
|
</li> |
556 |
</ol> |
</ol> |
557 |
</dd> |
</dd> |
558 |
</dl> |
</dl> |
559 |
|
</li> |
560 |
<p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize |
<li>Then, <var>r</var> is the |
561 |
an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>:</p> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
562 |
<ol> |
representation of <var>ss</var>.</li> |
|
<li>Replace the escape sequences (<code>\</code> and following |
|
|
characters) in <var>n</var> by characters represented by them |
|
|
respectively.</li> |
|
|
<li>If there is any character that is <em>not</em> one of |
|
|
<code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
|
|
(<code class=char>-</code>), <code class=char>U+0030</code> |
|
|
<code class=charname>DIGIT ZERO</code> |
|
|
(<code class=char>0</code>) to <code class=char>U+0039</code> |
|
|
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
|
|
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
|
|
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
|
|
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
|
|
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
|
|
(<code class=char>_</code>), <code class=char>U+0061</code> |
|
|
<code class=charname>LATIN SMALL LETTER A</code> |
|
|
(<code class=char>a</code>) to <code class=char>U+006A</code> |
|
|
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
|
|
<code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or |
|
|
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
|
|
<var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
|
|
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
|
|
hexadecimal representation of the character. If the character |
|
|
is outside the range of <code>[<code class=char>U+0000</code>, |
|
|
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
|
|
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li> |
|
|
<li>If the first character in <var>n</var> is one of |
|
|
<code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code> |
|
|
(<code class=char>0</code>) to <code class=char>U+0039</code> |
|
|
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
|
|
then prepend a string <code>\00003</code> at the beginning of |
|
|
<var>n</var>.</li> |
|
|
<li>If the first character in <var>n</var> is <code class=char>U+002D</code> |
|
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and |
|
|
the second character, if any, is <em>not</em> one of |
|
|
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
|
|
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
|
|
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
|
|
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
|
|
(<code class=char>_</code>), <code class=char>U+0061</code> |
|
|
<code class=charname>LATIN SMALL LETTER A</code> |
|
|
(<code class=char>a</code>) to <code class=char>U+006A</code> |
|
|
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
|
|
<code>U+0080</code> to <code>U+D7FF</code>, or |
|
|
<code>U+E000</code> to <code>U+10FFFF</code>, or |
|
|
<var>n</var> is equal to <code class=char>U+002D</code> |
|
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then |
|
|
replace the <code class=char>U+002D</code> |
|
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) |
|
|
character by string <code>\00002D</code>.</li> |
|
|
<li>Then, <var>n</var> is the result of the algorithm.</li> |
|
563 |
</ol> |
</ol> |
564 |
|
|
565 |
<p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize |
</div> |
566 |
a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p> |
|
567 |
|
<div class=section id=serializing-groups-of-selectors> |
568 |
|
<h3>Serializing Groups of Selectors</h3> |
569 |
|
|
570 |
|
<p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
571 |
|
representation is defined for an invalid |
572 |
|
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
573 |
|
selectors</a>.</p> |
574 |
|
|
575 |
|
<p>To |
576 |
|
<dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize |
577 |
|
a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>, |
578 |
|
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
579 |
<ol> |
<ol> |
580 |
<li>Replace the escape sequences (<code>\</code> and following |
<li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li> |
581 |
characters) in <var>s</var> by characters represented by them |
<li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in |
582 |
(or an empty string if <code>\</code> is immediately followed by |
<var>gs</var>: |
583 |
newline character(s)) respectively.</li> |
<ol> |
584 |
<li>Remove the quotation characters in <var>s</var> |
<li>If <var>selector</var> is <em>not</em> the first selector |
585 |
if <var>s</var> is a <code>STRING</code>.</li> |
in the <var>gs</var>, then append a <code class=char>U+002C</code> |
586 |
<li>If there is any character that is <em>not</em> one of |
<code class=charname>COMMA</code> (<code class=char>,</code>) followed by a |
587 |
<code class=char>U+0020</code> <code class=charname>SPACE</code>, |
<a href="#newline">newline</a> to <var>result</var>.</li> |
588 |
<code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
<li>Append four <code class=char>U+0020</code> |
589 |
(<code class=char>!</code>), <code class=char>U+0023</code> |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
590 |
<code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to |
<li>Process each sequence of simple selectors or |
591 |
<code class=char>U+005B</code> <code class=charname>LEFT SQUARE |
combinator in <var>selector</var> as following: |
592 |
BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT |
<dl class=switch> |
593 |
SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or |
<dt>If it is a sequence of simle selector |
594 |
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
(<dfn id=var-sss><var>sss</var></dfn>)</dt> |
595 |
<var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
<dd> |
596 |
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
<ol> |
597 |
hexadecimal representation of the character. If the character |
<li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize |
598 |
is outside the range of <code>[<code class=char>U+0000</code>, |
each simple selector</a> in <var>sss</var>.</li> |
599 |
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
<li class=ed>sort</li> |
600 |
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li> |
<li>Append a <a href="#newline">newline</a> to <var>result</var>.</li> |
601 |
<li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
</ol> |
602 |
MARK</code> (<code class=char>"</code>) at the beginning of <var>s</var>.</li> |
</dd> |
603 |
<li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
<dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt> |
604 |
MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</li> |
<dd> |
605 |
<li>Then, <var>s</var> is the result of the algorithm.</li> |
<ol> |
606 |
</ol> |
<li>Append two <code class=char>U+0020</code> |
607 |
|
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
608 |
|
<li>Process <var>c</var> as following: |
609 |
|
|
610 |
<p>A <dfn id=newline title=newline>newline</dfn> |
<dl class=switch> |
611 |
<em class=rfc2119>SHOULD</em> be represented as a |
<dt>If <var>c</var> is descendant combinator (white space)</dt> |
612 |
<code class=char>U+000A</code> <code class=charname>LINE FEED</code> |
<dd>Append a <code class=char>U+0020</code> |
613 |
character. However, depending on the context where |
<code class=charname>SPACE</code> character to |
614 |
the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
<var>result</var>.</dd> |
615 |
representation is in use, a sequence of |
<dt>If <var>c</var> is child combinator |
616 |
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
(<code class=char>></code>)</dt> |
617 |
followed by a <code class=char>U+000A</code> |
<dd>Append a <code class=char>U+003E</code> |
618 |
<code class=charname>LINE FEED</code> (i.e. a |
<code class=charname>GREATER-THAN SIGN</code> |
619 |
<code>CRLF</code> sequence) or a character |
(<code class=char>></code>) character to <var>result</var>.</dd> |
620 |
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
<dt>If <var>c</var> is adjacent sibling combinator |
621 |
<em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead. |
(<code class=char>+</code>)</dt> |
622 |
<a href="#newline">Newline</a> representations |
<dd>Append a <code class=char>U+002B</code> |
623 |
<em class=rfc2119>SHOULD</em> be consistent in an |
<code class=charname>PLUS SIGN</code> (<code class=char>+</code>) |
624 |
|
character to <var>result</var>.</dd> |
625 |
|
<dt>If <var>c</var> is general sibling combinator |
626 |
|
(<code class=char>~</code>)</dt> |
627 |
|
<dd>Append a <code class=char>U+007E</code> |
628 |
|
<code class=charname>TILDE</code> (<code class=char>~</code>) |
629 |
|
character to <var>result</var>.</dd> |
630 |
|
</dl> |
631 |
|
</li> |
632 |
|
<li>Append a <code class=char>U+0020</code> |
633 |
|
<code class=charname>SPACE</code> character to |
634 |
|
<var>result</var>.</li> |
635 |
|
</ol> |
636 |
|
</dd> |
637 |
|
</dl> |
638 |
|
</ol> |
639 |
|
</li> |
640 |
|
<li>Then, <var>result</var> is the |
641 |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
642 |
representation.</p> |
representation of <var>gs</var>.</li> |
643 |
|
</ol> |
644 |
|
|
|
<div class="note memo"> |
|
|
<p>Therefore, newlines must be normalized before |
|
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
|
|
representations are literally compared.</p> |
|
645 |
</div> |
</div> |
646 |
|
|
647 |
</div> |
</div> |
649 |
<div class="section" id="parsing"> |
<div class="section" id="parsing"> |
650 |
<h2>Parsing |
<h2>Parsing |
651 |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
652 |
Groups of Selectors</h2> |
Representations of Selectors</h2> |
653 |
|
|
654 |
<p>Since <a href="#serializing">the serializing algorithm</a> is |
<p>Since <a href="#algorithm-serialize-a-group-of-selectors">the serializing |
655 |
so designed that it always output a valid |
algorithm for groups of selectors</a> is so designed that it always outputs a |
656 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
valid <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
657 |
selectors</a>, no special parser for the |
selectors</a>, no special parser for the |
658 |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
659 |
representation is necessary. Any conforming parser for |
representation is necessary. Any conforming parser for |
660 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of |
661 |
selectors</a> <em class=rfc2119>MAY</em> be used |
selectors</a> <em class=rfc2119>MAY</em> be used |
662 |
to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
663 |
representations of groups of selectors.</p> |
representations of |
664 |
|
<a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of |
665 |
|
selectors</a>.</p> |
666 |
|
|
667 |
|
<p>Likewise, <a href="#algorithm-serialize-a-simple-selector">the serializing |
668 |
|
algorithm for simple selectors</a> always outputs a valid |
669 |
|
<a href="#simple-selector">simple selector</a> and therefore any |
670 |
|
conforming parser for <a href="#simple-selector">simple selector</a> |
671 |
|
<em class=rfc2119>MAY</em> be used to parse |
672 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
673 |
|
representations of <a href="#simple-selector">simple selectors</a>.</p> |
674 |
</div> |
</div> |
675 |
|
|
676 |
<div class="section" id="examples"> |
<div class="section" id="examples"> |
706 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
707 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
708 |
<time datetime=1997-03>March 1997</time>. |
<time datetime=1997-03>March 1997</time>. |
709 |
This version of the specification is referenced</dd> |
This version of the specification is referenced.</dd> |
710 |
<dt id=ref-SELECTORS>SELECTORS</dt> |
<dt id=ref-SELECTORS>SELECTORS</dt> |
711 |
<dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>, |
<dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>, |
712 |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |