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 |
|
|
175 |
<div class=section id=serializing-tokens> |
<div class=section id=serializing-tokens> |
176 |
<h3>Serializing Tokens</h3> |
<h3>Serializing Tokens</h3> |
177 |
|
|
178 |
<p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize |
<p>To <dfn id=algorithm-normalize-an-ident title="normalize a string as an IDENT">normalize |
179 |
an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>, |
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> |
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
181 |
<ol> |
<ol> |
182 |
<li>Replace the escape sequences (<code>\</code> and following |
<li>If <var>n</var> is either an <code>IDENT</code> or a <code>HASH</code>, |
183 |
characters) in <var>n</var> by characters represented by them |
replace the escape sequences (<code>\</code> and following characters) in |
184 |
respectively.</li> |
<var>n</var> by characters represented by them respectively.</li> |
185 |
|
<li>If <var>n</var> is a <code>HASH</code>, remove the leading |
186 |
|
<code class=char>U+0023</code> <code class=charname>NUMBER SIGN</code> |
187 |
|
(<code class=char>#</code>) character from <var>n</var>.</li> |
188 |
<li>If there is any character that is <em>not</em> one of |
<li>If there is any character that is <em>not</em> one of |
189 |
<code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
<code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
190 |
(<code class=char>-</code>), <code class=char>U+0030</code> |
(<code class=char>-</code>), <code class=char>U+0030</code> |
234 |
<li>Then, <var>n</var> is the result of the algorithm.</li> |
<li>Then, <var>n</var> is the result of the algorithm.</li> |
235 |
</ol> |
</ol> |
236 |
|
|
237 |
<p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize |
<p>To <dfn id=algorithm-normalize-a-string title="normalize a string (STRING or IDENT) as a STRING">normalize |
238 |
a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>, |
a string (<dfn id=var-s><var>s</var></dfn>) as a <code>STRING</code></dfn>, |
239 |
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
240 |
<ol> |
<ol> |
241 |
<li><p>Replace the escape sequences (<code>\</code> and following |
<li>If <var>s</var> is either an <code>IDENT</code> or a |
242 |
characters) in <var>s</var> by characters represented by them |
<code>STRING</code>, replace the escape sequences (<code>\</code> and |
243 |
|
following characters) in <var>s</var> by characters represented by them |
244 |
(or an empty string if <code>\</code> is immediately followed by |
(or an empty string if <code>\</code> is immediately followed by |
245 |
newline character(s)) respectively.</p></li> |
newline character(s)) respectively.</li> |
246 |
<li><p>Remove the quotation characters in <var>s</var> |
<li>If <var>s</var> is a <code>STRING</code>, remove the quotation marks |
247 |
if <var>s</var> is a <code>STRING</code>.</p> |
enclosing <var>s</var>.</li> |
|
|
|
|
<div class="note memo"> |
|
|
<p>The input <var>s</var> to this algorithm may be an |
|
|
<code>IDENT</code>.</p> |
|
|
</div></li> |
|
248 |
<li><p>If there is any character that is <em>not</em> one of |
<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>, |
<code class=char>U+0020</code> <code class=charname>SPACE</code>, |
250 |
<code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
<code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
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> |
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>r</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> |
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 |
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>r</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> |
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, to <var>r</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>r</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> |
415 |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
<code class=charname>COLON</code> (<code class=char>:</code>) character |
416 |
to <var>r</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 (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Bclass to |
name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Bclass to |
420 |
<var>r</var>.</li> |
<var>r</var>.</li> |
421 |
<li>Append any arguments as following: |
<li>Append any arguments as following: |
427 |
PARENTHESIS</code> (<code class=char>(</code>) character |
PARENTHESIS</code> (<code class=char>(</code>) character |
428 |
to <var>r</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>r</var>. |
language tag (the argument) to <var>r</var>. |
432 |
<span class="issue ed">Should we normalize cases?</span></li> |
<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> |
543 |
<code class=charname>COLON</code> characters (<code>::</code>) |
<code class=charname>COLON</code> characters (<code>::</code>) |
544 |
to <var>r</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 (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Belement |
name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Belement |
548 |
to <var>r</var>.</li> |
to <var>r</var>.</li> |
549 |
<li>If the pseudo$B!>(Belement has any arguments: |
<li>If the pseudo$B!>(Belement has any arguments: |