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-07>7 October 2007</time></h2> |
<h2>Working Draft <time datetime=2007-10-15>15 October 2007</time></h2> |
14 |
|
|
15 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
<dt>This Version</dt> |
145 |
for now.</p> |
for now.</p> |
146 |
</div> |
</div> |
147 |
|
|
148 |
<p><dfn id=newline title=newline>Newline</dfn> is |
<p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
149 |
<code class=char>U+000A</code> <code class=charname>LINE FEED</code> |
representation is defined for an invalid group of selectors.</p> |
150 |
<span class=ed>or U+000D U+000A or U+000A ??</span>.</p> |
|
151 |
|
<div class="note memo"> |
152 |
|
<p>The serialized representation will not contain any comment.</p> |
153 |
|
</div> |
154 |
|
|
155 |
<!-- TODO: link terms to Selectors --> |
<!-- TODO: link terms to Selectors --> |
156 |
|
|
173 |
<dl class=switch> |
<dl class=switch> |
174 |
<dt>If it is a sequence of simle selector |
<dt>If it is a sequence of simle selector |
175 |
(<dfn id=var-sss><var>sss</var></dfn>)</dt> |
(<dfn id=var-sss><var>sss</var></dfn>)</dt> |
176 |
<dd class=ed>@@</dd> |
<dd> |
177 |
|
<ol> |
178 |
|
<li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize |
179 |
|
each simple selector</a> in <var>sss</var>.</li> |
180 |
|
<li class=ed>sort</li> |
181 |
|
<li>Append a <a href="#newline">newline</a> to <var>result</var>.</li> |
182 |
|
</ol> |
183 |
|
</dd> |
184 |
<dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt> |
<dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt> |
185 |
<dd> |
<dd> |
186 |
<ol> |
<ol> |
218 |
</ol> |
</ol> |
219 |
</li> |
</li> |
220 |
<li>Then, <var>result</var> is the |
<li>Then, <var>result</var> is the |
221 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
222 |
representation of the group of selectors.</li> |
representation of <var>gs</var>.</li> |
223 |
</ol> |
</ol> |
224 |
|
|
225 |
<p>To |
<p>To |
257 |
</ol> |
</ol> |
258 |
</dd> |
</dd> |
259 |
<dt>If <var>ss</var> is an attribute selector</dt> |
<dt>If <var>ss</var> is an attribute selector</dt> |
260 |
<dd class=ed>@@</dd> |
<dd> |
261 |
|
<ol> |
262 |
|
<li>Append a <code class=char>U+005B</code> <code class=charname>LEFT |
263 |
|
SQUARE BRACKET</code> (<code class=char>[</code>) to |
264 |
|
<var>result</var>.</li> |
265 |
|
<li> |
266 |
|
Append a namespace prefix as following: |
267 |
|
<dl> |
268 |
|
<dt>If a namespace URI is specified</dt> |
269 |
|
<dd class=ed>@@</dd> |
270 |
|
<dd class=ed>@@ Current reference implementation is wrong, |
271 |
|
since its result of sorting depends on namespace prefix.</dd> |
272 |
|
<dt>If the null namespace is specified</dt> |
273 |
|
<dd>Append a <code class=char>U+007C</code> |
274 |
|
<code class=charname>VERTICAL BAR</code> character to |
275 |
|
<var>result</var>.</dd> |
276 |
|
<dt>If no namespace is specified</dt> |
277 |
|
<dd>Append a <code class=char>U+002A</code> |
278 |
|
<code class=charname>ASTERISK</code> (<code class=char>*</code>) |
279 |
|
character, followed by a <code class=char>U+007C</code> |
280 |
|
<code class=charname>VERTICAL BAR</code> (<code class=char>|</code>) |
281 |
|
character, to <var>result</var>.</dd> |
282 |
|
</dl> |
283 |
|
</li> |
284 |
|
<li>Append the <span class=ed>@@ normalized</span> local name to |
285 |
|
<var>result</var>.</li> |
286 |
|
<li>If a value is specified in <var>ss</var>: |
287 |
|
<ol> |
288 |
|
<li>Depending on the way to match, append <code>=</code>, |
289 |
|
<code>~=</code>, <code>|=</code>, <code>^=</code>, |
290 |
|
<code>$=</code>, or <code>*=</code> to <var>result</var>.</li> |
291 |
|
<li>Append the <span class=ed>@@ normalized</span> value to |
292 |
|
<var>result</var>.</li> |
293 |
|
</ol> |
294 |
|
</li> |
295 |
|
<li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT |
296 |
|
SQUARE BRACKET</code> (<code class=char>]</code>) to |
297 |
|
<var>result</var>.</li> |
298 |
|
</ol> |
299 |
|
</dd> |
300 |
<dt>If <var>ss</var> is a class selector</dt> |
<dt>If <var>ss</var> is a class selector</dt> |
301 |
<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 |
302 |
STOP</code> (<code class=char>.</code>) character, followed |
STOP</code> (<code class=char>.</code>) character, followed |
313 |
<li>Append a <code class=char>U+003A</code> |
<li>Append a <code class=char>U+003A</code> |
314 |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
315 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
316 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append the <span class=ed>@@ normalized</span> name of the |
317 |
pseudo$B!>(Bclass name to <var>result</var>.</li> |
pseudo$B!>(Bclass to <var>result</var>.</li> |
318 |
<li>Append any arguments as following: |
<li>Append any arguments as following: |
319 |
<dl class=switch> |
<dl class=switch> |
320 |
<dt>If pseudo$B!>(Bclass name is <code>lang</code></dt> |
<dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt> |
321 |
<dd> |
<dd> |
322 |
<ol> |
<ol> |
323 |
<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 |
331 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
332 |
</ol> |
</ol> |
333 |
</dd> |
</dd> |
334 |
<dt>If pseudo$B!>(Bclass name is <code>-manakai-contains</code></dt> |
<dt>If the name of the pseudo$B!>(Bclass is |
335 |
|
<code>-manakai-contains</code></dt> |
336 |
<dd> |
<dd> |
337 |
<ol> |
<ol> |
338 |
<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 |
346 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
347 |
</ol> |
</ol> |
348 |
</dd> |
</dd> |
349 |
<dt>If pseudo$B!>(Bclass name is <code>nth-child</code>, |
<dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>, |
350 |
<code>nth-last-child</code>, <code>nth-of-type</code>, or |
<code>nth-last-child</code>, <code>nth-of-type</code>, or |
351 |
<code>nth-last-of-type</code></dt> |
<code>nth-last-of-type</code></dt> |
352 |
<dd> |
<dd> |
388 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
389 |
</ol> |
</ol> |
390 |
</dd> |
</dd> |
391 |
<dt>If pseudo$B!>(Bclass name is <code>not</code></dt> |
<dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt> |
392 |
<dd class=ed>@@</dd> |
<dd> |
393 |
|
<ol> |
394 |
|
<li>Append a string of <code class=char>U+003A</code> |
395 |
|
<code class=charname>COLON</code>, <code class=char>U+006E</code> |
396 |
|
<code class=charname>LATIN SMALL LETTER N</code>, |
397 |
|
<code class=char>U+006F</code> <code class=charname>LATIN |
398 |
|
SMALL LETTER O</code>, <code class=char>U+0074</code> |
399 |
|
<code class=charname>LATIN SMALL LETTER T</code>, and |
400 |
|
<code class=char>U+0028</code> <code class=charname>LEFT |
401 |
|
PARENTHESIS</code> (<code>:not(</code>), followed by a |
402 |
|
<a href="#newline">newline</a>, to <var>result</var>.</li> |
403 |
|
<li>Append four <code class=char>U+0020</code> |
404 |
|
<code class=charname>SPACE</code> characters to |
405 |
|
<var>result</var>.</li> |
406 |
|
<li>Append four <code class=char>U+0020</code> |
407 |
|
<code class=charname>SPACE</code> characters to |
408 |
|
<var>result</var> again.</li> |
409 |
|
<li><a href="#algorithm-serialize-a-simple-selector">Serialize |
410 |
|
the simple selector specified as the argument to the |
411 |
|
<code>not</code> pseudo$B!>(Bclass</a>.</li> |
412 |
|
<li>Append a <a href="#newline">newline</a> to |
413 |
|
<var>result</var>.</li> |
414 |
|
<li>Append four <code class=char>U+0020</code> |
415 |
|
<code class=charname>SPACE</code> characters to |
416 |
|
<var>result</var>.</li> |
417 |
|
<li>Append a <code class=char>U+0029</code> |
418 |
|
<code class=charname>RIGHT PARENTHESIS</code> |
419 |
|
(<code class=char>)</code>) character |
420 |
|
to <var>result</var>.</li> |
421 |
|
</ol> |
422 |
|
</dd> |
423 |
</dl> |
</dl> |
424 |
</li> |
</li> |
425 |
</ol> |
</ol> |
430 |
<li>Append two <code class=char>U+003A</code> |
<li>Append two <code class=char>U+003A</code> |
431 |
<code class=charname>COLON</code> characters (<code>::</code>) |
<code class=charname>COLON</code> characters (<code>::</code>) |
432 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
433 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append the <span class=ed>@@ normalized</span> name of the |
434 |
pseudo$B!>(Belement name to <var>result</var>.</li> |
pseudo$B!>(Belement to <var>result</var>.</li> |
435 |
<!-- For future version: append "(", arguments, ")", if any. --> |
<!-- For future version: append "(", arguments, ")", if any. --> |
436 |
</ol> |
</ol> |
437 |
</dd> |
</dd> |
438 |
</dl> |
</dl> |
439 |
|
|
440 |
|
|
441 |
|
<p>A <dfn id=newline title=newline>newline</dfn> |
442 |
|
<em class=rfc2119>SHOULD</em> be represented as a |
443 |
|
<code class=char>U+000A</code> <code class=charname>LINE FEED</code> |
444 |
|
character. However, depending on the context where |
445 |
|
the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
446 |
|
representation is in use, a sequence of |
447 |
|
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
448 |
|
followed by a <code class=char>U+000A</code> |
449 |
|
<code class=charname>LINE FEED</code> (i.e. a |
450 |
|
<code>CRLF</code> sequence) or a character |
451 |
|
<code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code> |
452 |
|
<em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead. |
453 |
|
<a href="#newline">Newline</a> representations |
454 |
|
<em class=rfc2119>SHOULD</em> be consistent in an |
455 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
456 |
|
representation.</p> |
457 |
|
|
458 |
|
<div class="note memo"> |
459 |
|
<p>Therefore, newlines must be normalized before |
460 |
|
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
461 |
|
representations are literally compared.</p> |
462 |
|
</div> |
463 |
|
|
464 |
</div> |
</div> |
465 |
|
|
466 |
<div class="section" id="parsing"> |
<div class="section" id="parsing"> |
467 |
<h2>Parsing |
<h2>Parsing |
468 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
469 |
Groups of Selectors</h2> |
Groups of Selectors</h2> |
470 |
|
|
471 |
<p>Since <a href="#serializing">the serializing algorithm</a> is |
<p>Since <a href="#serializing">the serializing algorithm</a> is |
472 |
so designed that it always output a valid |
so designed that it always output a valid |
473 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
474 |
selectors</a>, no special parser for |
selectors</a>, no special parser for the |
475 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
<abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
476 |
is necessary. Any conforming |
representation is necessary. Any conforming parser for |
477 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of |
478 |
selectors</a> parser <em class=rfc2119>MAY</em> be used |
selectors</a> <em class=rfc2119>MAY</em> be used |
479 |
to parse <abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr> |
480 |
groups of selectors.</p> |
representations of groups of selectors.</p> |
481 |
</div> |
</div> |
482 |
|
|
483 |
<div class="section" id="examples"> |
<div class="section" id="examples"> |