/[suikacvs]/markup/selectors/ssft/ssft-work.en.html
Suika

Contents of /markup/selectors/ssft/ssft-work.en.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations) (download) (as text)
Mon Oct 22 10:38:19 2007 UTC (16 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.11: +18 -1 lines
File MIME type: text/html
Markup subsections

1 wakaba 1.1 <!DOCTYPE html>
2     <html lang="en" class="formal-specification status-work-in-progress">
3     <head>
4 wakaba 1.2 <title>Selectors Serialization Format for Testing (SSFT) Specification</title>
5 wakaba 1.1 <link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec">
6     <link rel="license" href="http://suika.fam.cx/c/gnu/fdl">
7     </head>
8     <body class="has-abstract">
9    
10     <div class="header">
11 wakaba 1.2 <h1>Selectors Serialization Format for Testing (<abbr>SSFT</abbr>)
12     Specification</h1>
13 wakaba 1.11 <h2>Working Draft <time datetime=2007-10-22>22 October 2007</time></h2>
14 wakaba 1.1
15     <dl class="versions-uri">
16     <dt>This Version</dt>
17     <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/selectors/ssft/ssft"
18     >http://suika.fam.cx/www/markup/selectors/ssft/ssft</a>&gt;</code></dd>
19     <dt>Latest Version</dt>
20     <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/selectors/ssft/ssft"
21     >http://suika.fam.cx/www/markup/selectors/ssft/ssft</a>&gt;</code></dd>
22     <!--
23     <dt>Latest Working Draft</dt>
24     -->
25     <!-- <dt>Previous Version</dt> -->
26 wakaba 1.5 <dt>Version History</dt>
27     <dd><code class=URI>&lt;<a href="http://suika.fam.cx/gate/cvs/markup/selectors/ssft/ssft.en.html">http://suika.fam.cx/gate/cvs/markup/selectors/ssft/ssft.en.html</a>&gt;</code></dd>
28 wakaba 1.1 </dl>
29     <dl class="authors" id="author">
30     <dt>Author</dt>
31     <dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author"
32     lang=ja>Wakaba</a>
33     <code class="mail">&lt;<a href="mailto:w@suika.fam.cx" rel="author"
34     >w@suika.fam.cx</a>&gt;</code></dd>
35     </dl>
36    
37 wakaba 1.5 <p class="copyright" lang="en">&#xA9; <time>2007</time> <a
38 wakaba 1.1 href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>.
39     Permission is granted to copy, distribute and/or modify this document
40     under the terms of the <a rel="license"
41     href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>,
42     Version 1.2
43     or any later version published by the <a
44     href="http://www.fsf.org/">Free Software Foundation</a>;
45     with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover
46     Texts. A copy of the license is
47     available at <code class="URI">&lt;<a
48     href="http://www.gnu.org/copyleft/fdl.html"
49     rel="license">http://www.gnu.org/copyleft/fdl.html</a>&gt;</code>.</p>
50     </div>
51    
52     <div id="abstract" class="section">
53     <h2>Abstract</h2>
54    
55     <div class="ed issue">...</div>
56    
57     </div>
58    
59     <div id="status" class="section">
60     <h2>Status of This Document</h2>
61    
62 wakaba 1.5 <p class=section-info><em>This section describes the status of this document
63 wakaba 1.1 at the time of its publication. Other documents
64     might supersede this document.</em></p>
65    
66 wakaba 1.10 <p>This document is a working draft, produced as part of the
67     <a href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>
68     subproject
69 wakaba 1.5 of the <a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a>
70     project. It might be updated, replaced, or obsoleted by
71 wakaba 1.1 other documents at any time. It is inappropriate to
72     cite this document as other than <q>work in progress</q>.</p>
73    
74     <p>Comments on this document are welcome and
75     may be sent to the <a href="#author">author</a>.</p>
76    
77     <p>Translations of thie document might be available.
78     The English version of the document is the only
79     normative version.</p>
80     </div>
81    
82     <div id="introduction" class="section">
83     <h2>Introduction</h2>
84    
85 wakaba 1.7 <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
86 wakaba 1.5
87     <p>Selectors
88     <cite class="bibref normative">[<a href="#ref-SELECTORS">SELECTORS</a>]</cite>
89     are patterns that match against elements
90     in a tree structure and are used in Web technologies, including
91     <a href="http://www.w3.org/TR/CSS21"><abbr title="Cascading Style Sheets">CSS</abbr></a>
92     <cite class="bibref informative">[<a href="#ref-CSS">CSS</a>]</cite>,
93     <a href="http://whatwg.org/html5"><abbr title="Hypertext Markup Language">HTML</abbr>5</a>
94     <cite class="bibref informative">[<a href="#ref-HTML5">HTML5</a>]</cite>,
95     <a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr title="XML Binding Language">XBL</abbr>2</a>
96     <cite class="bibref informative">[<a href="#ref-XBL2">XBL2</a>]</cite>, and
97     <a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&amp;content-type=text/html;%20charset=utf-8">Selectors
98     <abbr>API</abbr></a>
99     <cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p>
100 wakaba 1.4
101 wakaba 1.1 <div class="issue ed">...</div>
102    
103 wakaba 1.4 <p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The
104     <abbr title="Cascading Style Sheets Object Model">CSSOM</abbr>
105     specification</a>
106 wakaba 1.5 <cite class="bibref informative">[<a href="#ref-CSSOM">CSSOM</a>]</cite>
107 wakaba 1.4 is trying to define an algorithm to
108     <a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&amp;content-type=text/html;%20charset=utf-8#serializing0">serialize
109     a group of selectors</a> for the purpose of <code>selectorText</code>
110     attribute. However, the algorithm is incomplete
111 wakaba 1.5 <time datetime=2007-09-25>at the time of the writing</time>.
112     Note that current Web browser implementations
113 wakaba 1.4 of the <code>selectorText</code> attribute are consistently broken
114     in not escaping unsafe identifiers.</p>
115    
116 wakaba 1.1 </div>
117    
118     <div class="section" id="terminology">
119     <h2>Terminology</h2>
120    
121 wakaba 1.10 <p>The key words <q><dfn id=must><em class="rfc2119">MUST</em></dfn></q>,
122     <q><dfn id=must-not><em class="rfc2119">MUST NOT</em></dfn></q>,
123     <q><dfn id=should><em class="rfc2119">SHOULD</em></dfn></q>,
124     <q><dfn id=should-not><em class="rfc2119">SHOULD NOT</em></dfn></q>, and
125     <q><dfn id=may><em class=rfc2119>MAY</em></dfn></q> in this
126 wakaba 1.1 document are to be interpreted as described in
127 wakaba 1.5 <a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr>
128     2119</a>
129 wakaba 1.1 <cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p>
130 wakaba 1.5
131     <!-- Strictly speaking the paragraph below is not part of terminology. -->
132 wakaba 1.7 <p>All examples and notes in this specification are non$B!>(Bnormative,
133     as are all sections explicitly marked non$B!>(Bnormative. Everything
134 wakaba 1.5 else in this specification is normative.</p>
135 wakaba 1.7
136     <p>For the purpose of this specification, pseudo$B!>(Belements are also
137     referred to as <dfn title="simple selector" id=simple-selector>simple
138     selectors</dfn> and are considered as part of the last sequence of
139     simple selector in a selector.</p>
140 wakaba 1.1 </div>
141    
142     <div class="section" id="serializing">
143 wakaba 1.12 <h2>Serializing in
144     <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
145     Representation</h2>
146 wakaba 1.1
147     <div class="issue ed">
148     <p><a href="http://suika.fam.cx/gate/cvs/*checkout*/markup/html/whatpm/Whatpm/CSS/SelectorsSerializer.pm">See the reference implementation</a>
149     for now.</p>
150     </div>
151 wakaba 1.3
152 wakaba 1.12 <div class=section id=serializing-groups-of-selectors>
153     <h3>Serializing Groups of Selectors</h3>
154    
155 wakaba 1.8 <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
156     representation is defined for an invalid group of selectors.</p>
157    
158     <div class="note memo">
159     <p>The serialized representation will not contain any comment.</p>
160     </div>
161 wakaba 1.3
162 wakaba 1.4 <!-- TODO: link terms to Selectors -->
163    
164 wakaba 1.7 <p>To
165     <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize
166     a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p>
167 wakaba 1.3 <ol>
168 wakaba 1.6 <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>
169     <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in
170     <var>gs</var>:
171 wakaba 1.3 <ol>
172     <li>If <var>selector</var> is <em>not</em> the first selector
173     in the group of selectors, then append a <code class=char>U+002C</code>
174 wakaba 1.7 <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a
175 wakaba 1.3 <a href="#newline">newline</a> to <var>result</var>.</li>
176     <li>Append four <code class=char>U+0020</code>
177     <code class=charname>SPACE</code> characters to <var>result</var>.</li>
178     <li>Process each sequence of simple selectors or
179     combinator in <var>selector</var> by following algorithm:
180     <dl class=switch>
181 wakaba 1.6 <dt>If it is a sequence of simle selector
182     (<dfn id=var-sss><var>sss</var></dfn>)</dt>
183 wakaba 1.9 <dd>
184     <ol>
185     <li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize
186     each simple selector</a> in <var>sss</var>.</li>
187     <li class=ed>sort</li>
188     <li>Append a <a href="#newline">newline</a> to <var>result</var>.</li>
189     </ol>
190     </dd>
191 wakaba 1.6 <dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt>
192 wakaba 1.3 <dd>
193     <ol>
194     <li>Append two <code class=char>U+0020</code>
195     <code class=charname>SPACE</code> characters to <var>result</var>.</li>
196     <li>
197     <dl class=switch>
198     <dt>If <var>c</var> is descendant combinator (white space)</dt>
199     <dd>Append a <code class=char>U+0020</code>
200     <code class=charname>SPACE</code> character to
201     <var>result</var>.</dd>
202     <dt>If <var>c</var> is child combinator
203     (<code class=char>></code>)</dt>
204     <dd>Append a <code class=char>U+003E</code>
205 wakaba 1.7 <code class=charname>GREATER-THAN SIGN</code>
206     (<code class=char>></code>) character to <var>result</var>.</dd>
207 wakaba 1.3 <dt>If <var>c</var> is adjacent sibling combinator
208     (<code class=char>+</code>)</dt>
209 wakaba 1.5 <dd>Append a <code class=char>U+002B</code>
210 wakaba 1.7 <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)
211     character to <var>result</var>.</dd>
212 wakaba 1.3 <dt>If <var>c</var> is general sibling combinator
213     (<code class=char>~</code>)</dt>
214     <dd>Append a <code class=char>U+007E</code>
215 wakaba 1.7 <code class=charname>TILDE</code> (<code class=char>~</code>)
216     character to <var>result</var>.</dd>
217 wakaba 1.3 </dl>
218     </li>
219     <li>Append a <code class=char>U+0020</code>
220     <code class=charname>SPACE</code> character to
221     <var>result</var>.</li>
222     </ol>
223     </dd>
224     </dl>
225     </ol>
226     </li>
227     <li>Then, <var>result</var> is the
228 wakaba 1.8 <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
229     representation of <var>gs</var>.</li>
230 wakaba 1.3 </ol>
231 wakaba 1.6
232 wakaba 1.12 </div>
233    
234     <div class=section id=serializing-simple-selectors>
235     <h3>Serializing Simple Selectors</h3>
236    
237 wakaba 1.7 <p>To
238     <dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize
239     a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>:</p>
240 wakaba 1.6 <dl class=switch>
241     <dt>If <var>ss</var> is a type or universal selector</dt>
242 wakaba 1.7 <dd>
243     <ol>
244     <li>
245     <dl class=switch>
246     <dt>If a namespace URI is specified (via namespace prefix, or
247     by omitting namespace prefix where a default namespace is specified)</dt>
248     <dd class="ed">@@</dd>
249     <dt>If the null namespace is specified (by zero$B!>(Blength namespace
250     prefix)</dt>
251     <dd>Append a <code class=char>U+007C</code>
252     <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
253     character to <var>result</var>.</dd>
254     <dt>If no namespace is specified (by namespace prefix <code>*</code>,
255     or by omitting namespace prefix where no default namespace is
256     specified)</dt>
257     <dd>Append a <code class=char>U+002A</code>
258     <code class=charname>ASTERISK</code> (<code class=char>*</code>)
259     character, followed by a <code class=char>U+007C</code>
260     <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
261     character, to <var>result</var>.</dd>
262     </dl>
263     </li>
264     <li>If <var>ss</var> is a type selector, append the
265 wakaba 1.11 <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
266     local name to <var>result</var>.</li>
267 wakaba 1.7 <li>If <var>ss</var> is a universal selector, append
268     a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>
269     (<code class=char>*</code>) character to <var>result</var>.</li>
270     </ol>
271     </dd>
272     <dt>If <var>ss</var> is an attribute selector</dt>
273 wakaba 1.9 <dd>
274     <ol>
275     <li>Append a <code class=char>U+005B</code> <code class=charname>LEFT
276     SQUARE BRACKET</code> (<code class=char>[</code>) to
277     <var>result</var>.</li>
278     <li>
279     Append a namespace prefix as following:
280     <dl>
281     <dt>If a namespace URI is specified</dt>
282     <dd class=ed>@@</dd>
283     <dd class=ed>@@ Current reference implementation is wrong,
284     since its result of sorting depends on namespace prefix.</dd>
285     <dt>If the null namespace is specified</dt>
286     <dd>Append a <code class=char>U+007C</code>
287     <code class=charname>VERTICAL BAR</code> character to
288     <var>result</var>.</dd>
289     <dt>If no namespace is specified</dt>
290     <dd>Append a <code class=char>U+002A</code>
291     <code class=charname>ASTERISK</code> (<code class=char>*</code>)
292     character, followed by a <code class=char>U+007C</code>
293     <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
294     character, to <var>result</var>.</dd>
295     </dl>
296     </li>
297 wakaba 1.11 <li>Append the
298     <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
299     local name to <var>result</var>.</li>
300 wakaba 1.9 <li>If a value is specified in <var>ss</var>:
301     <ol>
302     <li>Depending on the way to match, append <code>=</code>,
303     <code>~=</code>, <code>|=</code>, <code>^=</code>,
304     <code>$=</code>, or <code>*=</code> to <var>result</var>.</li>
305 wakaba 1.11 <li>Append the
306     <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
307     value to <var>result</var>.</li>
308 wakaba 1.9 </ol>
309     </li>
310     <li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT
311     SQUARE BRACKET</code> (<code class=char>]</code>) to
312     <var>result</var>.</li>
313     </ol>
314     </dd>
315 wakaba 1.7 <dt>If <var>ss</var> is a class selector</dt>
316     <dd>Append a <code class=char>U+002E</code> <code class=charname>FULL
317     STOP</code> (<code class=char>.</code>) character, followed
318 wakaba 1.11 by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
319     class name, <var>result</var>.</dd>
320 wakaba 1.7 <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>
321     <dd>Append a <code class=char>U+0023</code> <code class=charname>NUMBER
322     SIGN</code> (<code class=char>#</code>) character, followed
323 wakaba 1.11 by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
324     <abbr>ID</abbr>, to <var>result</var>.</dd>
325 wakaba 1.7 <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>
326     <dd>
327     <ol>
328     <li>Append a <code class=char>U+003A</code>
329     <code class=charname>COLON</code> (<code class=char>:</code>) character
330     to <var>result</var>.</li>
331 wakaba 1.11 <li>Append the
332     <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
333     name of the pseudo$B!>(Bclass to <var>result</var>.</li>
334 wakaba 1.7 <li>Append any arguments as following:
335     <dl class=switch>
336 wakaba 1.8 <dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt>
337 wakaba 1.7 <dd>
338     <ol>
339     <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
340     PARENTHESIS</code> (<code class=char>(</code>) character
341     to <var>result</var>.</li>
342 wakaba 1.11 <li>Append the
343     <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
344 wakaba 1.7 language tag (the argument) to <var>result</var>.</li>
345     <li>Append a <code class=char>U+0029</code>
346     <code class=charname>RIGHT PARENTHESIS</code>
347     (<code class=char>)</code>) character
348     to <var>result</var>.</li>
349     </ol>
350     </dd>
351 wakaba 1.8 <dt>If the name of the pseudo$B!>(Bclass is
352     <code>-manakai-contains</code></dt>
353 wakaba 1.7 <dd>
354     <ol>
355     <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
356     PARENTHESIS</code> (<code class=char>(</code>) character
357     to <var>result</var>.</li>
358 wakaba 1.11 <li>Append the
359     <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
360 wakaba 1.7 string (the argument) to <var>result</var>.</li>
361     <li>Append a <code class=char>U+0029</code>
362     <code class=charname>RIGHT PARENTHESIS</code>
363     (<code class=char>)</code>) character
364     to <var>result</var>.</li>
365     </ol>
366     </dd>
367 wakaba 1.8 <dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>,
368 wakaba 1.7 <code>nth-last-child</code>, <code>nth-of-type</code>, or
369     <code>nth-last-of-type</code></dt>
370     <dd>
371     <ol>
372     <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
373     PARENTHESIS</code> (<code class=char>(</code>) character
374     to <var>result</var>.</li>
375     <li>Append <span class=ed>@@ normalized</span>
376     integer <var>a</var> to <var>result</var>.
377     If the argument is a keyword <code>odd</code> or <code>even</code>,
378     <var>a</var> is <code>2</code>. If <var>a</var> and
379     <code>n</code> is omitted, <var>a</var> is assumed as
380     <code>0</code>. Otherwise, if <var>a</var> is omitted,
381     it is assumed as <code>1</code> (or <code>-1</code>,
382     if there is a <code class=char>U+002D</code>
383     <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
384     character).</li>
385     <li>Append a <code class=char>U+006E</code>
386     <code class=charname>LATIN SMALL LETTER N</code>
387     (<code class=char>n</code>) character to <var>result</var>.</li>
388     <li>Append <span class=ed>@@ normalized</span>
389     integer <var>b</var> to <var>result</var>.
390     It <em class=rfc2119>MUST</em> be preceded by a sign,
391     either <code class=char>U+002B</code> <code class=charname>PLUS
392     SIGN</code> (<code class=char>+</code>) or
393     <code class=char>U+002D</code>
394     <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
395     character. If the argument is a keyword <code>odd</code>,
396     <var>b</var> is <code>1</code>. If the argument
397     is a keyword <code>even</code>, <var>b</var> is
398     <code>0</code>. If <var>b</var> is omitted, it is assumed as
399     <code>0</code>. The sign of <code>0</code>
400     <em class=rfc2119>MUST</em> be <code class=char>U+002B</code>
401     <code class=charname>PLUS SIGN</code>
402     (<code class=char>+</code>).</li>
403     <li>Append a <code class=char>U+0029</code>
404     <code class=charname>RIGHT PARENTHESIS</code>
405     (<code class=char>)</code>) character
406     to <var>result</var>.</li>
407     </ol>
408     </dd>
409 wakaba 1.8 <dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt>
410     <dd>
411     <ol>
412     <li>Append a string of <code class=char>U+003A</code>
413     <code class=charname>COLON</code>, <code class=char>U+006E</code>
414     <code class=charname>LATIN SMALL LETTER N</code>,
415     <code class=char>U+006F</code> <code class=charname>LATIN
416     SMALL LETTER O</code>, <code class=char>U+0074</code>
417     <code class=charname>LATIN SMALL LETTER T</code>, and
418     <code class=char>U+0028</code> <code class=charname>LEFT
419     PARENTHESIS</code> (<code>:not(</code>), followed by a
420     <a href="#newline">newline</a>, to <var>result</var>.</li>
421     <li>Append four <code class=char>U+0020</code>
422     <code class=charname>SPACE</code> characters to
423     <var>result</var>.</li>
424     <li>Append four <code class=char>U+0020</code>
425     <code class=charname>SPACE</code> characters to
426     <var>result</var> again.</li>
427     <li><a href="#algorithm-serialize-a-simple-selector">Serialize
428     the simple selector specified as the argument to the
429     <code>not</code> pseudo$B!>(Bclass</a>.</li>
430     <li>Append a <a href="#newline">newline</a> to
431     <var>result</var>.</li>
432     <li>Append four <code class=char>U+0020</code>
433     <code class=charname>SPACE</code> characters to
434     <var>result</var>.</li>
435     <li>Append a <code class=char>U+0029</code>
436     <code class=charname>RIGHT PARENTHESIS</code>
437     (<code class=char>)</code>) character
438     to <var>result</var>.</li>
439     </ol>
440     </dd>
441 wakaba 1.7 </dl>
442     </li>
443     </ol>
444     </dd>
445     <dt>If <var>ss</var> is a pseudo$B!>(Belement</dt>
446     <dd>
447     <ol>
448     <li>Append two <code class=char>U+003A</code>
449     <code class=charname>COLON</code> characters (<code>::</code>)
450     to <var>result</var>.</li>
451 wakaba 1.11 <li>Append the
452     <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
453     name of the pseudo$B!>(Belement to <var>result</var>.</li>
454 wakaba 1.7 <!-- For future version: append "(", arguments, ")", if any. -->
455     </ol>
456     </dd>
457 wakaba 1.6 </dl>
458 wakaba 1.1
459 wakaba 1.12 </div>
460    
461     <div class=section id=serializing-tokens>
462     <h3>Serializing Tokens</h3>
463    
464 wakaba 1.11 <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize
465     an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>:</p>
466     <ol>
467     <li>Replace the escape sequences (<code>\</code> and following
468     characters) in <var>n</var> by characters represented by them
469     respectively.</li>
470     <li>If there is any character that is <em>not</em> one of
471     <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
472     (<code class=char>-</code>), <code class=char>U+0030</code>
473     <code class=charname>DIGIT ZERO</code>
474     (<code class=char>0</code>) to <code class=char>U+0039</code>
475     <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
476     <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
477     A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
478     <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
479     <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
480     (<code class=char>_</code>), <code class=char>U+0061</code>
481     <code class=charname>LATIN SMALL LETTER A</code>
482     (<code class=char>a</code>) to <code class=char>U+006A</code>
483     <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
484     <code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or
485     <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
486     <var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
487     <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
488     hexadecimal representation of the character. If the character
489     is outside the range of <code>[<code class=char>U+0000</code>,
490     <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
491     <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>
492     <li>If the first character in <var>n</var> is one of
493     <code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>
494     (<code class=char>0</code>) to <code class=char>U+0039</code>
495     <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
496     then prepend a string <code>\00003</code> at the beginning of
497     <var>n</var>.</li>
498     <li>If the first character in <var>n</var> is <code class=char>U+002D</code>
499     <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and
500     the second character, if any, is <em>not</em> one of
501     <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
502     A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
503     <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
504     <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
505     (<code class=char>_</code>), <code class=char>U+0061</code>
506     <code class=charname>LATIN SMALL LETTER A</code>
507     (<code class=char>a</code>) to <code class=char>U+006A</code>
508     <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
509     <code>U+0080</code> to <code>U+D7FF</code>, or
510     <code>U+E000</code> to <code>U+10FFFF</code>, or
511     <var>n</var> is equal to <code class=char>U+002D</code>
512     <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then
513     replace the <code class=char>U+002D</code>
514     <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
515     character by string <code>\00002D</code>.</li>
516     <li>Then, <var>n</var> is the result of the algorithm.</li>
517     </ol>
518    
519     <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize
520     a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p>
521     <ol>
522     <li>Replace the escape sequences (<code>\</code> and following
523     characters) in <var>s</var> by characters represented by them
524     (or an empty string if <code>\</code> is immediately followed by
525     newline character(s)) respectively.</li>
526     <li>Remove the quotation characters in <var>s</var>
527     if <var>s</var> is a <code>STRING</code>.</li>
528     <li>If there is any character that is <em>not</em> one of
529     <code class=char>U+0020</code> <code class=charname>SPACE</code>,
530     <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
531     (<code class=char>!</code>), <code class=char>U+0023</code>
532     <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to
533     <code class=char>U+005B</code> <code class=charname>LEFT SQUARE
534     BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT
535     SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or
536     <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
537     <var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
538     <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
539     hexadecimal representation of the character. If the character
540     is outside the range of <code>[<code class=char>U+0000</code>,
541     <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
542     <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>
543     <li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
544     MARK</code> (<code class=char>"</code>) at the beginning of <var>s</var>.</li>
545     <li>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
546     MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</li>
547     <li>Then, <var>s</var> is the result of the algorithm.</li>
548     </ol>
549 wakaba 1.8
550     <p>A <dfn id=newline title=newline>newline</dfn>
551     <em class=rfc2119>SHOULD</em> be represented as a
552     <code class=char>U+000A</code> <code class=charname>LINE FEED</code>
553     character. However, depending on the context where
554     the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
555     representation is in use, a sequence of
556     <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
557     followed by a <code class=char>U+000A</code>
558 wakaba 1.9 <code class=charname>LINE FEED</code> (i.e. a
559     <code>CRLF</code> sequence) or a character
560 wakaba 1.8 <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
561 wakaba 1.9 <em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead.
562     <a href="#newline">Newline</a> representations
563     <em class=rfc2119>SHOULD</em> be consistent in an
564     <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
565     representation.</p>
566 wakaba 1.8
567     <div class="note memo">
568 wakaba 1.9 <p>Therefore, newlines must be normalized before
569 wakaba 1.8 <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
570 wakaba 1.9 representations are literally compared.</p>
571 wakaba 1.12 </div>
572    
573 wakaba 1.8 </div>
574    
575 wakaba 1.1 </div>
576    
577     <div class="section" id="parsing">
578     <h2>Parsing
579 wakaba 1.8 <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
580 wakaba 1.1 Groups of Selectors</h2>
581    
582     <p>Since <a href="#serializing">the serializing algorithm</a> is
583     so designed that it always output a valid
584     <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of
585 wakaba 1.8 selectors</a>, no special parser for the
586     <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
587     representation is necessary. Any conforming parser for
588     <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of
589     selectors</a> <em class=rfc2119>MAY</em> be used
590     to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
591     representations of groups of selectors.</p>
592 wakaba 1.1 </div>
593    
594     <div class="section" id="examples">
595     <h2>Examples</h2>
596    
597 wakaba 1.7 <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
598 wakaba 1.1
599     <div class="ed issue">
600     <p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>,
601 wakaba 1.7 by choosing <q>Selectors</q> radio button.</p>
602 wakaba 1.1
603     <div class="example figure block">
604     <div class="caption">...</div>
605    
606     <pre><code>...</code></pre>
607     </div>
608    
609     </div>
610    
611     </div>
612    
613     <div id="references" class="section reference">
614 wakaba 1.7 <h2>References</h2>
615 wakaba 1.1
616     <div id="normative-references" class="section normative reference">
617     <h3>Normative References</h3>
618    
619     <dl>
620     <dt id="ref-KEYWORDS">KEYWORDS</dt>
621 wakaba 1.4 <dd><cite><a href="urn:ietf:rfc:2119">Key words for use in
622     <abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>,
623     <abbr title="Internet Engineering Task Force">IETF</abbr>
624     <a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr>
625 wakaba 1.5 14</a>, <abbr title="Request for Comments">RFC</abbr> 2119,
626     <time datetime=1997-03>March 1997</time>.
627 wakaba 1.4 This version of the specification is referenced</dd>
628 wakaba 1.1 <dt id=ref-SELECTORS>SELECTORS</dt>
629 wakaba 1.2 <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>,
630     <abbr title="World Wide Web Consortium">W3C</abbr> Working Draft,
631 wakaba 1.5 <time datetime=2005-12-15>15 December 2005</time>. Work in progress.
632 wakaba 1.2 <a href="http://www.w3.org/TR/css3-selectors">The latest version</a>
633     of the specification is referenced.</dd>
634 wakaba 1.1 </dl>
635     </div>
636    
637     <div id="informative-references" class="section informative reference">
638 wakaba 1.7 <h3>Non$B!>(Bnormative References</h3>
639 wakaba 1.1
640     <dl>
641 wakaba 1.5 <dt id=ref-CSS>CSS</dt>
642     <dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading
643     Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1)
644     Specification</a></cite>,
645     <abbr title="World Wide Web Consortium">W3C</abbr> Candidate
646     Recommendation, <time datetime=2007-07-19>19 July 2007</time>.
647     Work in progress. The latest version of the specification is
648     available at
649     <code class=URI>&lt;<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd>
650 wakaba 1.4 <dt id=ref-CSSOM>CSSOM</dt>
651     <dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&amp;content-type=text/html;%20charset=utf-8">Cascading
652     Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>,
653     <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
654 wakaba 1.5 <time datetime=2007-06-18>18 June 2007</time>. Work in progress.
655     The latest Editor's Draft of the specification is available at
656     <code class=URI>&lt;<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd>
657     <dt id=ref-HTML5>HTML5</dt>
658     <dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>,
659     <abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr>
660     Working Draft. Work in progress.</dd>
661     <dt id=ref-SAPI>SAPI</dt>
662     <dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&amp;content-type=text/html;%20charset=utf-8">Selectors <abbr>API</abbr></a></cite>,
663     <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
664     <time datetime=2007-08-29>29 August 2007</time>. Work in progress.
665     The latest Editor's Draft of the specification is available at
666     <code class=URI>&lt;<a href="http://dev.w3.org/2006/webapi/selectors-api/Overview.html">http://dev.w3.org/2006/webapi/selectors-api/Overview.html</a>></code>.
667     The latest published version of the specification is available at
668     <code class=URI>&lt;<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd>
669 wakaba 1.10 <dt id=ref-XBL2>XBL2</dt>
670 wakaba 1.5 <dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr>
671     2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>.
672     Work in progress. The latest
673     <abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished
674     version of the specification is available at
675     <code class=URI>&lt;<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd>
676 wakaba 1.1 </dl>
677     </div>
678    
679     </div>
680    
681     </body>
682     </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24