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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by wakaba, Tue Oct 2 10:13:58 2007 UTC revision 1.15 by wakaba, Mon Oct 22 11:00:57 2007 UTC
# Line 10  Line 10 
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-02>2 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>
# Line 63  available at <code class="URI">&lt;<a Line 63  available at <code class="URI">&lt;<a
63  at the time of its publication.  Other documents  at the time of its publication.  Other documents
64  might supersede this document.</em></p>  might supersede this document.</em></p>
65    
66  <p>This document is a working draft, produced as part  <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  of the <a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a>  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  project.  It might be updated, replaced, or obsoleted by
71  other documents at any time.  It is inappropriate to  other documents at any time.  It is inappropriate to
# Line 80  normative version.</p> Line 82  normative version.</p>
82  <div id="introduction" class="section">  <div id="introduction" class="section">
83  <h2>Introduction</h2>  <h2>Introduction</h2>
84    
85  <p class=section-info>This section is <em>non-normative</em>.</p>  <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
86    
87  <p>Selectors  <p>Selectors
88  <cite class="bibref normative">[<a href="#ref-SELECTORS">SELECTORS</a>]</cite>  <cite class="bibref normative">[<a href="#ref-SELECTORS">SELECTORS</a>]</cite>
# Line 116  in not escaping unsafe identifiers.</p> Line 118  in not escaping unsafe identifiers.</p>
118  <div class="section" id="terminology">  <div class="section" id="terminology">
119  <h2>Terminology</h2>  <h2>Terminology</h2>
120    
121  <p>The key words <q><em class="rfc2119">MUST</em></q>,  <p>The key words <q><dfn id=must><em class="rfc2119">MUST</em></dfn></q>,
122  <q><em class="rfc2119">MUST NOT</em></q>,  <q><dfn id=must-not><em class="rfc2119">MUST NOT</em></dfn></q>,
123  <q><em class="rfc2119">SHOULD</em></q>,  <q><dfn id=should><em class="rfc2119">SHOULD</em></dfn></q>,
124  <q><em class="rfc2119">SHOULD NOT</em></q>, and  <q><dfn id=should-not><em class="rfc2119">SHOULD NOT</em></dfn></q>, and
125  <q><em class=rfc2119>MAY</em></q> in this  <q><dfn id=may><em class=rfc2119>MAY</em></dfn></q> in this
126  document are to be interpreted as described in  document are to be interpreted as described in
127  <a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr>  <a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr>
128  2119</a>  2119</a>
129  <cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p>  <cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p>
130    
131    <p>Requirements phrased in the imperative as part of algorithms are to be
132    interpreted with the meaning of the key word (<em class=rfc2119>MUST</em>)
133    used in introducing the algorithm.</p>
134    
135    <p>Conformance requirements phrased as algorithms or specific steps
136    <em class=rfc2119>MAY</em> be implemented in any manner, so long as the end
137    result is equivalent.</p>
138    
139  <!-- Strictly speaking the paragraph below is not part of terminology. -->  <!-- Strictly speaking the paragraph below is not part of terminology. -->
140  <p>All examples and notes in this specification are non-normative,  <p>All examples and notes in this specification are non$B!>(Bnormative,
141  as are all sections explicitly marked non-normative.  Everything  as are all sections explicitly marked non$B!>(Bnormative.  Everything
142  else in this specification is normative.</p>  else in this specification is normative.</p>
143    
144    <p>For the purpose of this specification, pseudo$B!>(Belements are also
145    referred to as <dfn title="simple selector" id=simple-selector>simple
146    selectors</dfn> and are considered as part of the last sequence of
147    simple selector in a selector.</p>
148  </div>  </div>
149    
150  <div class="section" id="serializing">  <div class="section" id="serializing">
151  <h2>Serializing Groups of Selectors</h2>  <h2>Serializing Selectors as
152    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
153    Representation</h2>
154    
155  <div class="issue ed">  <div class="issue ed">
156  <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 the reference implementation</a>
157  for now.</p>  for now.</p>
158  </div>  </div>
159    
160  <p><dfn id=newline>Newline</dfn> is <code class=char>U+000A</code>  <div class="note memo">
161  <code class=charname>LINE FEED</code> <span class=ed>or  <p>The serialized representation will not contain any comment.</p>
162  U+000D U+000A or U+000A ??</span>.</p>  </div>
   
163  <!-- TODO: link terms to Selectors -->  <!-- TODO: link terms to Selectors -->
164    
165  <p>To <dfn id=algorithm-serialize-a-group-of-selectors>serialize a group of  <div class=section id=serializing-tokens>
166  selectors</dfn> (<dfn id=var-gs><var>gs</var></dfn>):</p>  <h3>Serializing Tokens</h3>
167    
168    <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize
169    an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>,
170    the following algorithm <em class=rfc2119>MUST</em> be used:</p>
171    <ol>
172    <li>Replace the escape sequences (<code>\</code> and following
173    characters) in <var>n</var> by characters represented by them
174    respectively.</li>
175    <li>If there is any character that is <em>not</em> one of
176    <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
177    (<code class=char>-</code>), <code class=char>U+0030</code>
178    <code class=charname>DIGIT ZERO</code>
179    (<code class=char>0</code>) to <code class=char>U+0039</code>
180    <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
181    <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
182    A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
183    <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
184    <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
185    (<code class=char>_</code>), <code class=char>U+0061</code>
186    <code class=charname>LATIN SMALL LETTER A</code>
187    (<code class=char>a</code>) to <code class=char>U+006A</code>
188    <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
189    <code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or
190    <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
191    <var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
192    <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
193    hexadecimal representation of the character.  If the character
194    is outside the range of <code>[<code class=char>U+0000</code>,
195    <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
196    <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>
197    <li>If the first character in <var>n</var> is one of
198    <code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>
199    (<code class=char>0</code>) to <code class=char>U+0039</code>
200    <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
201    then prepend a string <code>\00003</code> at the beginning of
202    <var>n</var>.</li>
203    <li>If the first character in <var>n</var> is <code class=char>U+002D</code>
204    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and
205    the second character, if any, is <em>not</em> one of
206    <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
207    A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
208    <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
209    <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
210    (<code class=char>_</code>), <code class=char>U+0061</code>
211    <code class=charname>LATIN SMALL LETTER A</code>
212    (<code class=char>a</code>) to <code class=char>U+006A</code>
213    <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
214    <code>U+0080</code> to <code>U+D7FF</code>, or
215    <code>U+E000</code> to <code>U+10FFFF</code>, or
216    <var>n</var> is equal to <code class=char>U+002D</code>
217    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then
218    replace the <code class=char>U+002D</code>
219    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
220    character by string <code>\00002D</code>.</li>
221    <li>Then, <var>n</var> is the result of the algorithm.</li>
222    </ol>
223    
224    <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize
225    a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>,
226    the following algorithm <em class=rfc2119>MUST</em> be used:</p>
227    <ol>
228    <li><p>Replace the escape sequences (<code>\</code> and following
229    characters) in <var>s</var> by characters represented by them
230    (or an empty string if <code>\</code> is immediately followed by
231    newline character(s)) respectively.</p></li>
232    <li><p>Remove the quotation characters in <var>s</var>
233    if <var>s</var> is a <code>STRING</code>.</p>
234    
235    <div class="note memo">
236    <p>The input <var>s</var> to this algorithm may be an
237    <code>IDENT</code>.</p>
238    </div></li>
239    <li><p>If there is any character that is <em>not</em> one of
240    <code class=char>U+0020</code> <code class=charname>SPACE</code>,
241    <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
242    (<code class=char>!</code>), <code class=char>U+0023</code>
243    <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to
244    <code class=char>U+005B</code> <code class=charname>LEFT SQUARE
245    BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT
246    SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or
247    <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
248    <var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
249    <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
250    hexadecimal representation of the character.  If the character
251    is outside the range of <code>[<code class=char>U+0000</code>,
252    <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
253    <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</p></li>
254    <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
255    MARK</code> (<code class=char>"</code>) at the beginning of
256    <var>s</var>.</p></li>
257    <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
258    MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</p></li>
259    <li><p>Then, <var>s</var> is the result of the algorithm.</p></li>
260    </ol>
261    
262    <p>A <dfn id=newline title=newline>newline</dfn>
263    <em class=rfc2119>SHOULD</em> be represented as a
264    <code class=char>U+000A</code> <code class=charname>LINE FEED</code>
265    character.  However, depending on the context where
266    the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
267    representation is in use, a sequence of
268    <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
269    followed by a <code class=char>U+000A</code>
270    <code class=charname>LINE FEED</code> (i.e. a
271    <code>CRLF</code> sequence) or a character
272    <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
273    <em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead.
274    <a href="#newline">Newline</a> representations
275    <em class=rfc2119>SHOULD</em> be consistent in an
276    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
277    representation.</p>
278    
279    <div class="note memo">
280    <p>Therefore, newlines must be normalized before
281    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
282    representations are literally compared.</p>
283    </div>
284    
285    </div>
286    
287    
288    <div class=section id=serializing-simple-selectors>
289    <h3>Serializing Simple Selectors</h3>
290    
291    <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
292    representation is defined for an invalid simple selector selector.</p>
293    
294    <p>To
295    <dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize
296    a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>,
297    the following algorithm <em class=rfc2119>MUST</em> be used:</p>
298    <dl class=switch>
299    <dt>If <var>ss</var> is a type or universal selector</dt>
300      <dd>
301        <ol>
302        <li>
303          <dl class=switch>
304          <dt>If a namespace URI is specified (via namespace prefix, or
305          by omitting namespace prefix where a default namespace is specified)</dt>
306            <dd class="ed">@@</dd>
307          <dt>If the null namespace is specified (by zero$B!>(Blength namespace
308          prefix)</dt>
309            <dd>Append a <code class=char>U+007C</code>
310            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
311            character to <var>result</var>.</dd>
312          <dt>If no namespace is specified (by namespace prefix <code>*</code>,
313          or by omitting namespace prefix where no default namespace is
314          specified)</dt>
315            <dd>Append a <code class=char>U+002A</code>
316            <code class=charname>ASTERISK</code> (<code class=char>*</code>)
317            character, followed by a <code class=char>U+007C</code>
318            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
319            character, to <var>result</var>.</dd>
320          </dl>
321        </li>
322        <li>If <var>ss</var> is a type selector, append the
323        <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
324        local name to <var>result</var>.</li>
325        <li>If <var>ss</var> is a universal selector, append
326        a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>
327        (<code class=char>*</code>) character to <var>result</var>.</li>
328        </ol>
329      </dd>
330    <dt>If <var>ss</var> is an attribute selector</dt>
331      <dd>
332        <ol>
333        <li>Append a <code class=char>U+005B</code> <code class=charname>LEFT
334        SQUARE BRACKET</code> (<code class=char>[</code>) to
335        <var>result</var>.</li>
336        <li>
337          Append a namespace prefix as following:
338          <dl>
339          <dt>If a namespace URI is specified</dt>
340            <dd class=ed>@@</dd>
341            <dd class=ed>@@ Current reference implementation is wrong,
342            since its result of sorting depends on namespace prefix.</dd>
343          <dt>If the null namespace is specified</dt>
344            <dd>Append a <code class=char>U+007C</code>
345            <code class=charname>VERTICAL BAR</code> character to
346            <var>result</var>.</dd>
347          <dt>If no namespace is specified</dt>
348            <dd>Append a <code class=char>U+002A</code>
349            <code class=charname>ASTERISK</code> (<code class=char>*</code>)
350            character, followed by a <code class=char>U+007C</code>
351            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
352            character, to <var>result</var>.</dd>
353          </dl>
354        </li>
355        <li>Append the
356        <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
357        local name to <var>result</var>.</li>
358        <li>If a value is specified in <var>ss</var>:
359          <ol>
360          <li>Depending on the way to match, append <code>=</code>,
361          <code>~=</code>, <code>|=</code>, <code>^=</code>,
362          <code>$=</code>, or <code>*=</code> to <var>result</var>.</li>
363          <li>Append the
364          <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
365          value to <var>result</var>.</li>
366          </ol>
367        </li>
368        <li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT
369        SQUARE BRACKET</code> (<code class=char>]</code>) to
370        <var>result</var>.</li>
371        </ol>
372      </dd>
373    <dt>If <var>ss</var> is a class selector</dt>
374      <dd>Append a <code class=char>U+002E</code> <code class=charname>FULL
375      STOP</code> (<code class=char>.</code>) character, followed
376      by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
377      class name, <var>result</var>.</dd>
378    <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>
379      <dd>Append a <code class=char>U+0023</code> <code class=charname>NUMBER
380      SIGN</code> (<code class=char>#</code>) character, followed
381      by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
382      <abbr>ID</abbr>, to <var>result</var>.</dd>
383    <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>
384      <dd>
385        <ol>
386        <li>Append a <code class=char>U+003A</code>
387        <code class=charname>COLON</code> (<code class=char>:</code>) character
388        to <var>result</var>.</li>
389        <li>Append the
390        <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
391        name of the pseudo$B!>(Bclass to <var>result</var>.</li>
392        <li>Append any arguments as following:
393          <dl class=switch>
394          <dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt>
395            <dd>
396              <ol>
397              <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
398              PARENTHESIS</code> (<code class=char>(</code>) character
399              to <var>result</var>.</li>
400              <li>Append the
401              <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
402              language tag (the argument) to <var>result</var>.</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          <dt>If the name of the pseudo$B!>(Bclass is
410          <code>-manakai-contains</code></dt>
411            <dd>
412              <ol>
413              <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
414              PARENTHESIS</code> (<code class=char>(</code>) character
415              to <var>result</var>.</li>
416              <li>Append the
417              <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
418              string (the argument) to <var>result</var>.</li>
419              <li>Append a <code class=char>U+0029</code>
420              <code class=charname>RIGHT PARENTHESIS</code>
421              (<code class=char>)</code>) character
422              to <var>result</var>.</li>
423              </ol>
424            </dd>
425          <dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>,
426          <code>nth-last-child</code>, <code>nth-of-type</code>, or
427          <code>nth-last-of-type</code></dt>
428            <dd>
429              <ol>
430              <li>Append a <code class=char>U+0028</code> <code class=charname>LEFT
431              PARENTHESIS</code> (<code class=char>(</code>) character
432              to <var>result</var>.</li>
433              <li>Append <span class=ed>@@ normalized</span>
434              integer <var>a</var> to <var>result</var>.
435              If the argument is a keyword <code>odd</code> or <code>even</code>,
436              <var>a</var> is <code>2</code>.  If <var>a</var> and
437              <code>n</code> is omitted, <var>a</var> is assumed as
438              <code>0</code>.  Otherwise, if <var>a</var> is omitted,
439              it is assumed as <code>1</code> (or <code>-1</code>,
440              if there is a <code class=char>U+002D</code>
441              <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
442              character).</li>
443              <li>Append a <code class=char>U+006E</code>
444              <code class=charname>LATIN SMALL LETTER N</code>
445              (<code class=char>n</code>) character to <var>result</var>.</li>
446              <li>Append <span class=ed>@@ normalized</span>
447              integer <var>b</var> to <var>result</var>.
448              It <em class=rfc2119>MUST</em> be preceded by a sign,
449              either <code class=char>U+002B</code> <code class=charname>PLUS
450              SIGN</code> (<code class=char>+</code>) or
451              <code class=char>U+002D</code>
452              <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
453              character.  If the argument is a keyword <code>odd</code>,
454              <var>b</var> is <code>1</code>.  If the argument
455              is a keyword <code>even</code>, <var>b</var> is
456              <code>0</code>.  If <var>b</var> is omitted, it is assumed as
457              <code>0</code>.  The sign of <code>0</code>
458              <em class=rfc2119>MUST</em> be <code class=char>U+002B</code>
459              <code class=charname>PLUS SIGN</code>
460              (<code class=char>+</code>).</li>
461              <li>Append a <code class=char>U+0029</code>
462              <code class=charname>RIGHT PARENTHESIS</code>
463              (<code class=char>)</code>) character
464              to <var>result</var>.</li>
465              </ol>
466            </dd>
467          <dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt>
468            <dd>
469              <ol>
470                <li>Append a string of <code class=char>U+003A</code>
471                <code class=charname>COLON</code>, <code class=char>U+006E</code>
472                <code class=charname>LATIN SMALL LETTER N</code>,
473                <code class=char>U+006F</code> <code class=charname>LATIN
474                SMALL LETTER O</code>, <code class=char>U+0074</code>
475                <code class=charname>LATIN SMALL LETTER T</code>, and
476                <code class=char>U+0028</code> <code class=charname>LEFT
477                PARENTHESIS</code> (<code>:not(</code>), followed by a
478                <a href="#newline">newline</a>, to <var>result</var>.</li>
479                <li>Append four <code class=char>U+0020</code>
480                <code class=charname>SPACE</code> characters to
481                <var>result</var>.</li>
482                <li>Append four <code class=char>U+0020</code>
483                <code class=charname>SPACE</code> characters to
484                <var>result</var> again.</li>
485                <li><a href="#algorithm-serialize-a-simple-selector">Serialize
486                the simple selector specified as the argument to the
487                <code>not</code> pseudo$B!>(Bclass</a>.</li>
488                <li>Append a <a href="#newline">newline</a> to
489                <var>result</var>.</li>
490                <li>Append four <code class=char>U+0020</code>
491                <code class=charname>SPACE</code> characters to
492                <var>result</var>.</li>
493                <li>Append a <code class=char>U+0029</code>
494                <code class=charname>RIGHT PARENTHESIS</code>
495                (<code class=char>)</code>) character
496                to <var>result</var>.</li>
497              </ol>
498            </dd>
499          </dl>
500        </li>
501        </ol>
502      </dd>
503    <dt>If <var>ss</var> is a pseudo$B!>(Belement</dt>
504      <dd>
505        <ol>
506        <li>Append two <code class=char>U+003A</code>
507        <code class=charname>COLON</code> characters (<code>::</code>)
508        to <var>result</var>.</li>
509        <li>Append the
510        <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
511        name of the pseudo$B!>(Belement to <var>result</var>.</li>
512        <!-- For future version: append "(", arguments, ")", if any. -->
513        </ol>
514      </dd>
515    </dl>
516    
517    </div>
518    
519    <div class=section id=serializing-groups-of-selectors>
520    <h3>Serializing Groups of Selectors</h3>
521    
522    <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
523    representation is defined for an invalid group of selectors.</p>
524    
525    <p>To
526    <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize
527    a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>,
528    the following algorithm <em class=rfc2119>MUST</em> be used:</p>
529  <ol>  <ol>
530  <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>  <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>
531  <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in  <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in
# Line 155  selectors</dfn> (<dfn id=var-gs><var>gs< Line 533  selectors</dfn> (<dfn id=var-gs><var>gs<
533    <ol>    <ol>
534    <li>If <var>selector</var> is <em>not</em> the first selector    <li>If <var>selector</var> is <em>not</em> the first selector
535    in the group of selectors, then append a <code class=char>U+002C</code>    in the group of selectors, then append a <code class=char>U+002C</code>
536    <code class=charname>COMMA</code> followed by a    <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a
537    <a href="#newline">newline</a> to <var>result</var>.</li>    <a href="#newline">newline</a> to <var>result</var>.</li>
538    <li>Append four <code class=char>U+0020</code>    <li>Append four <code class=char>U+0020</code>
539    <code class=charname>SPACE</code> characters to <var>result</var>.</li>    <code class=charname>SPACE</code> characters to <var>result</var>.</li>
# Line 164  selectors</dfn> (<dfn id=var-gs><var>gs< Line 542  selectors</dfn> (<dfn id=var-gs><var>gs<
542      <dl class=switch>      <dl class=switch>
543      <dt>If it is a sequence of simle selector      <dt>If it is a sequence of simle selector
544      (<dfn id=var-sss><var>sss</var></dfn>)</dt>      (<dfn id=var-sss><var>sss</var></dfn>)</dt>
545        <dd class=ed>@@</dd>        <dd>
546            <ol>
547            <li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize
548            each simple selector</a> in <var>sss</var>.</li>
549            <li class=ed>sort</li>
550            <li>Append a <a href="#newline">newline</a> to <var>result</var>.</li>
551            </ol>
552          </dd>
553      <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>
554        <dd>        <dd>
555          <ol>          <ol>
# Line 179  selectors</dfn> (<dfn id=var-gs><var>gs< Line 564  selectors</dfn> (<dfn id=var-gs><var>gs<
564            <dt>If <var>c</var> is child combinator            <dt>If <var>c</var> is child combinator
565            (<code class=char>></code>)</dt>            (<code class=char>></code>)</dt>
566              <dd>Append a <code class=char>U+003E</code>              <dd>Append a <code class=char>U+003E</code>
567              <code class=charname>GREATER-THAN SIGN</code> character to              <code class=charname>GREATER-THAN SIGN</code>
568              <var>result</var>.</dd>              (<code class=char>></code>) character to <var>result</var>.</dd>
569            <dt>If <var>c</var> is adjacent sibling combinator            <dt>If <var>c</var> is adjacent sibling combinator
570            (<code class=char>+</code>)</dt>            (<code class=char>+</code>)</dt>
571              <dd>Append a <code class=char>U+002B</code>              <dd>Append a <code class=char>U+002B</code>
572              <code class=charname>PLUS SIGN</code> character to              <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)
573              <var>result</var>.</dd>              character to <var>result</var>.</dd>
574            <dt>If <var>c</var> is general sibling combinator            <dt>If <var>c</var> is general sibling combinator
575            (<code class=char>~</code>)</dt>            (<code class=char>~</code>)</dt>
576              <dd>Append a <code class=char>U+007E</code>              <dd>Append a <code class=char>U+007E</code>
577              <code class=charname>TILDE</code> character to              <code class=charname>TILDE</code> (<code class=char>~</code>)
578              <var>result</var>.</dd>              character to <var>result</var>.</dd>
579            </dl>            </dl>
580          </li>          </li>
581          <li>Append a <code class=char>U+0020</code>          <li>Append a <code class=char>U+0020</code>
# Line 202  selectors</dfn> (<dfn id=var-gs><var>gs< Line 587  selectors</dfn> (<dfn id=var-gs><var>gs<
587    </ol>    </ol>
588  </li>  </li>
589  <li>Then, <var>result</var> is the  <li>Then, <var>result</var> is the
590  <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
591  representation of the group of selectors.</li>  representation of <var>gs</var>.</li>
592  </ol>  </ol>
593    
594  <p>To <dfn id=algorithm-serialize-a-simple-selector>serialize a simple  </div>
 selector</dfn> (<dfn><var id=var-ss>ss</var></dfn>):</p>  
 <dl class=switch>  
 <dt>If <var>ss</var> is a type or universal selector</dt>  
   <dd><dl class=switch>  
   <dt>If a namespace URI is specified (via namespace prefix, or  
   by omitting namespace prefix where a default namespace is specified)</dt>  
     <dd class="ed">@@</dd>  
   <dt>If the null namespace is specified (by zero$B!>(Blength namespace  
   prefix)</dt>  
     <dd>Return a <code class=char>U+007C</code> <code class=charname>VERTICAL  
     BAR</code> character, followed by either local name (if <var>ss</var>  
     is a type selector) or a <code class=char>U+002A</code>  
     <code class=charname>ASTERISK</code> character (if <var>ss</var>  
     is a universal selector).</dd>  
   <dt>If no namespace is specified (by namespace prefix <code>*</code>,  
   or by omitting namespace prefix where no default namespace is specified)</dt>  
     <dd>Return a <code class=char>U+002A</code>  
     <code class=charname>ASTERISK</code> character, followed by a  
     <code class=char>U+007C</code> <code class=charname>VERTICAL BAR</code>  
     character, followed by either local name (if <var>ss</var>  
     is a type selector) or a <code class=char>U+002A</code>  
     <code class=charname>ASTERISK</code> character (if <var>ss</var>  
     is a universal selector).</dd>  
   </dl></dd>  
 <dt class=ed>@@</dt>  
 </dl>  
595    
596  </div>  </div>
597    
598  <div class="section" id="parsing">  <div class="section" id="parsing">
599  <h2>Parsing  <h2>Parsing
600  <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
601  Groups of Selectors</h2>  Groups of Selectors</h2>
602    
603  <p>Since <a href="#serializing">the serializing algorithm</a> is  <p>Since <a href="#serializing">the serializing algorithm</a> is
604  so designed that it always output a valid  so designed that it always output a valid
605  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of
606  selectors</a>, no special parser for  selectors</a>, no special parser for the
607  <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
608  is necessary.  Any conforming  representation is necessary.  Any conforming parser for
609  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of  <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of
610  selectors</a> parser <em class=rfc2119>MAY</em> be used  selectors</a> <em class=rfc2119>MAY</em> be used
611  to parse <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
612  groups of selectors.</p>  representations of groups of selectors.</p>
613  </div>  </div>
614    
615  <div class="section" id="examples">  <div class="section" id="examples">
616  <h2>Examples</h2>  <h2>Examples</h2>
617    
618  <p class=section-info>This section is <em>non-normative</em>.</p>  <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
619    
620  <div class="ed issue">  <div class="ed issue">
621  <p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>,  <p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>,
622  by choosing <q>Selectors</q> radio button.</a></p>  by choosing <q>Selectors</q> radio button.</p>
623    
624  <div class="example figure block">  <div class="example figure block">
625  <div class="caption">...</div>  <div class="caption">...</div>
# Line 273  by choosing <q>Selectors</q> radio butto Line 632  by choosing <q>Selectors</q> radio butto
632  </div>  </div>
633    
634  <div id="references" class="section reference">  <div id="references" class="section reference">
635  <h2>References</h1>  <h2>References</h2>
636    
637  <div id="normative-references" class="section normative reference">  <div id="normative-references" class="section normative reference">
638  <h3>Normative References</h3>  <h3>Normative References</h3>
# Line 297  by choosing <q>Selectors</q> radio butto Line 656  by choosing <q>Selectors</q> radio butto
656  </div>  </div>
657    
658  <div id="informative-references" class="section informative reference">  <div id="informative-references" class="section informative reference">
659  <h3>Non-normative References</h3>  <h3>Non$B!>(Bnormative References</h3>
660    
661  <dl>  <dl>
662  <dt id=ref-CSS>CSS</dt>  <dt id=ref-CSS>CSS</dt>
# Line 328  by choosing <q>Selectors</q> radio butto Line 687  by choosing <q>Selectors</q> radio butto
687    <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>.    <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>.
688    The latest published version of the specification is available at    The latest published version of the specification is available at
689    <code class=URI>&lt;<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd>    <code class=URI>&lt;<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd>
690  <dt id=XBL2>XBL2</dt>  <dt id=ref-XBL2>XBL2</dt>
691    <dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr>    <dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr>
692    2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>.    2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>.
693    Work in progress.  The latest    Work in progress.  The latest

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24