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-15>15 October 2007</time></h2> |
<h2>Working Draft <time datetime=2007-10-22>22 October 2007</time></h2> |
14 |
|
|
15 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
<dt>This Version</dt> |
252 |
</dl> |
</dl> |
253 |
</li> |
</li> |
254 |
<li>If <var>ss</var> is a type selector, append the |
<li>If <var>ss</var> is a type selector, append the |
255 |
<span class=ed>@@ normalized</span> local name to <var>result</var>.</li> |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
256 |
|
local name to <var>result</var>.</li> |
257 |
<li>If <var>ss</var> is a universal selector, append |
<li>If <var>ss</var> is a universal selector, append |
258 |
a <code class=char>U+002A</code> <code class=charname>ASTERISK</code> |
a <code class=char>U+002A</code> <code class=charname>ASTERISK</code> |
259 |
(<code class=char>*</code>) character to <var>result</var>.</li> |
(<code class=char>*</code>) character to <var>result</var>.</li> |
284 |
character, to <var>result</var>.</dd> |
character, to <var>result</var>.</dd> |
285 |
</dl> |
</dl> |
286 |
</li> |
</li> |
287 |
<li>Append the <span class=ed>@@ normalized</span> local name to |
<li>Append the |
288 |
<var>result</var>.</li> |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
289 |
|
local name to <var>result</var>.</li> |
290 |
<li>If a value is specified in <var>ss</var>: |
<li>If a value is specified in <var>ss</var>: |
291 |
<ol> |
<ol> |
292 |
<li>Depending on the way to match, append <code>=</code>, |
<li>Depending on the way to match, append <code>=</code>, |
293 |
<code>~=</code>, <code>|=</code>, <code>^=</code>, |
<code>~=</code>, <code>|=</code>, <code>^=</code>, |
294 |
<code>$=</code>, or <code>*=</code> to <var>result</var>.</li> |
<code>$=</code>, or <code>*=</code> to <var>result</var>.</li> |
295 |
<li>Append the <span class=ed>@@ normalized</span> value to |
<li>Append the |
296 |
<var>result</var>.</li> |
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
297 |
|
value to <var>result</var>.</li> |
298 |
</ol> |
</ol> |
299 |
</li> |
</li> |
300 |
<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 |
305 |
<dt>If <var>ss</var> is a class selector</dt> |
<dt>If <var>ss</var> is a class selector</dt> |
306 |
<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 |
307 |
STOP</code> (<code class=char>.</code>) character, followed |
STOP</code> (<code class=char>.</code>) character, followed |
308 |
by <span class=ed>@@ normalized</span> class name, |
by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
309 |
<var>result</var>.</dd> |
class name, <var>result</var>.</dd> |
310 |
<dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt> |
<dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt> |
311 |
<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 |
312 |
SIGN</code> (<code class=char>#</code>) character, followed |
SIGN</code> (<code class=char>#</code>) character, followed |
313 |
by <span class=ed>@@ normalized</span> <abbr>ID</abbr>, |
by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
314 |
to <var>result</var>.</dd> |
<abbr>ID</abbr>, to <var>result</var>.</dd> |
315 |
<dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt> |
<dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt> |
316 |
<dd> |
<dd> |
317 |
<ol> |
<ol> |
318 |
<li>Append a <code class=char>U+003A</code> |
<li>Append a <code class=char>U+003A</code> |
319 |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
320 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
321 |
<li>Append the <span class=ed>@@ normalized</span> name of the |
<li>Append the |
322 |
pseudo$B!>(Bclass to <var>result</var>.</li> |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
323 |
|
name of the pseudo$B!>(Bclass to <var>result</var>.</li> |
324 |
<li>Append any arguments as following: |
<li>Append any arguments as following: |
325 |
<dl class=switch> |
<dl class=switch> |
326 |
<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> |
329 |
<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 |
330 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
331 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
332 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append the |
333 |
|
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
334 |
language tag (the argument) to <var>result</var>.</li> |
language tag (the argument) to <var>result</var>.</li> |
335 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
336 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
345 |
<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 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
347 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
348 |
<li>Append <span class=ed>@@ normalized</span> |
<li>Append the |
349 |
|
<a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a> |
350 |
string (the argument) to <var>result</var>.</li> |
string (the argument) to <var>result</var>.</li> |
351 |
<li>Append a <code class=char>U+0029</code> |
<li>Append a <code class=char>U+0029</code> |
352 |
<code class=charname>RIGHT PARENTHESIS</code> |
<code class=charname>RIGHT PARENTHESIS</code> |
438 |
<li>Append two <code class=char>U+003A</code> |
<li>Append two <code class=char>U+003A</code> |
439 |
<code class=charname>COLON</code> characters (<code>::</code>) |
<code class=charname>COLON</code> characters (<code>::</code>) |
440 |
to <var>result</var>.</li> |
to <var>result</var>.</li> |
441 |
<li>Append the <span class=ed>@@ normalized</span> name of the |
<li>Append the |
442 |
pseudo$B!>(Belement to <var>result</var>.</li> |
<a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a> |
443 |
|
name of the pseudo$B!>(Belement to <var>result</var>.</li> |
444 |
<!-- For future version: append "(", arguments, ")", if any. --> |
<!-- For future version: append "(", arguments, ")", if any. --> |
445 |
</ol> |
</ol> |
446 |
</dd> |
</dd> |
447 |
</dl> |
</dl> |
448 |
|
|
449 |
|
<p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize |
450 |
|
an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>:</p> |
451 |
|
<ol> |
452 |
|
<li>Replace the escape sequences (<code>\</code> and following |
453 |
|
characters) in <var>n</var> by characters represented by them |
454 |
|
respectively.</li> |
455 |
|
<li>If there is any character that is <em>not</em> one of |
456 |
|
<code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
457 |
|
(<code class=char>-</code>), <code class=char>U+0030</code> |
458 |
|
<code class=charname>DIGIT ZERO</code> |
459 |
|
(<code class=char>0</code>) to <code class=char>U+0039</code> |
460 |
|
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
461 |
|
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
462 |
|
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
463 |
|
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
464 |
|
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
465 |
|
(<code class=char>_</code>), <code class=char>U+0061</code> |
466 |
|
<code class=charname>LATIN SMALL LETTER A</code> |
467 |
|
(<code class=char>a</code>) to <code class=char>U+006A</code> |
468 |
|
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
469 |
|
<code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or |
470 |
|
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
471 |
|
<var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
472 |
|
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
473 |
|
hexadecimal representation of the character. If the character |
474 |
|
is outside the range of <code>[<code class=char>U+0000</code>, |
475 |
|
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
476 |
|
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li> |
477 |
|
<li>If the first character in <var>n</var> is one of |
478 |
|
<code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code> |
479 |
|
(<code class=char>0</code>) to <code class=char>U+0039</code> |
480 |
|
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>), |
481 |
|
then prepend a string <code>\00003</code> at the beginning of |
482 |
|
<var>n</var>.</li> |
483 |
|
<li>If the first character in <var>n</var> is <code class=char>U+002D</code> |
484 |
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and |
485 |
|
the second character, if any, is <em>not</em> one of |
486 |
|
<code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
487 |
|
A</code> (<code class=char>A</code>) to <code class=char>U+005A</code> |
488 |
|
<code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>), |
489 |
|
<code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
490 |
|
(<code class=char>_</code>), <code class=char>U+0061</code> |
491 |
|
<code class=charname>LATIN SMALL LETTER A</code> |
492 |
|
(<code class=char>a</code>) to <code class=char>U+006A</code> |
493 |
|
<code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>), |
494 |
|
<code>U+0080</code> to <code>U+D7FF</code>, or |
495 |
|
<code>U+E000</code> to <code>U+10FFFF</code>, or |
496 |
|
<var>n</var> is equal to <code class=char>U+002D</code> |
497 |
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then |
498 |
|
replace the <code class=char>U+002D</code> |
499 |
|
<code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) |
500 |
|
character by string <code>\00002D</code>.</li> |
501 |
|
<li>Then, <var>n</var> is the result of the algorithm.</li> |
502 |
|
</ol> |
503 |
|
|
504 |
|
<p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize |
505 |
|
a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p> |
506 |
|
<ol> |
507 |
|
<li>Replace the escape sequences (<code>\</code> and following |
508 |
|
characters) in <var>s</var> by characters represented by them |
509 |
|
(or an empty string if <code>\</code> is immediately followed by |
510 |
|
newline character(s)) respectively.</li> |
511 |
|
<li>Remove the quotation characters in <var>s</var> |
512 |
|
if <var>s</var> is a <code>STRING</code>.</li> |
513 |
|
<li>If there is any character that is <em>not</em> one of |
514 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code>, |
515 |
|
<code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
516 |
|
(<code class=char>!</code>), <code class=char>U+0023</code> |
517 |
|
<code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to |
518 |
|
<code class=char>U+005B</code> <code class=charname>LEFT SQUARE |
519 |
|
BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT |
520 |
|
SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or |
521 |
|
<code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in |
522 |
|
<var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where |
523 |
|
<dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded |
524 |
|
hexadecimal representation of the character. If the character |
525 |
|
is outside the range of <code>[<code class=char>U+0000</code>, |
526 |
|
<code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var> |
527 |
|
<em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li> |
528 |
|
<li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
529 |
|
MARK</code> (<code class=char>"</code>) at the beginning of <var>s</var>.</li> |
530 |
|
<li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION |
531 |
|
MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</li> |
532 |
|
<li>Then, <var>s</var> is the result of the algorithm.</li> |
533 |
|
</ol> |
534 |
|
|
535 |
<p>A <dfn id=newline title=newline>newline</dfn> |
<p>A <dfn id=newline title=newline>newline</dfn> |
536 |
<em class=rfc2119>SHOULD</em> be represented as a |
<em class=rfc2119>SHOULD</em> be represented as a |