/[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.7 by wakaba, Sun Oct 7 08:50:13 2007 UTC revision 1.14 by wakaba, Mon Oct 22 10:46:10 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-07>7 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 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>
# Line 138  simple selector in a selector.</p> Line 140  simple selector in a selector.</p>
140  </div>  </div>
141    
142  <div class="section" id="serializing">  <div class="section" id="serializing">
143  <h2>Serializing Groups of Selectors</h2>  <h2>Serializing Selectors as
144    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
145    Representation</h2>
146    
147  <div class="issue ed">  <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>  <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>  for now.</p>
150  </div>  </div>
151    
152  <p><dfn id=newline title=newline>Newline</dfn> is  <div class=section id=serializing-tokens>
153  <code class=char>U+000A</code> <code class=charname>LINE FEED</code>  <h3>Serializing Tokens</h3>
 <span class=ed>or U+000D U+000A or U+000A ??</span>.</p>  
154    
155  <!-- TODO: link terms to Selectors -->  <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize
156    an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>:</p>
157    <ol>
158    <li>Replace the escape sequences (<code>\</code> and following
159    characters) in <var>n</var> by characters represented by them
160    respectively.</li>
161    <li>If there is any character that is <em>not</em> one of
162    <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
163    (<code class=char>-</code>), <code class=char>U+0030</code>
164    <code class=charname>DIGIT ZERO</code>
165    (<code class=char>0</code>) to <code class=char>U+0039</code>
166    <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
167    <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
168    A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
169    <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
170    <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
171    (<code class=char>_</code>), <code class=char>U+0061</code>
172    <code class=charname>LATIN SMALL LETTER A</code>
173    (<code class=char>a</code>) to <code class=char>U+006A</code>
174    <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
175    <code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or
176    <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
177    <var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
178    <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
179    hexadecimal representation of the character.  If the character
180    is outside the range of <code>[<code class=char>U+0000</code>,
181    <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
182    <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>
183    <li>If the first character in <var>n</var> is one of
184    <code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>
185    (<code class=char>0</code>) to <code class=char>U+0039</code>
186    <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
187    then prepend a string <code>\00003</code> at the beginning of
188    <var>n</var>.</li>
189    <li>If the first character in <var>n</var> is <code class=char>U+002D</code>
190    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and
191    the second character, if any, is <em>not</em> one of
192    <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
193    A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
194    <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
195    <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
196    (<code class=char>_</code>), <code class=char>U+0061</code>
197    <code class=charname>LATIN SMALL LETTER A</code>
198    (<code class=char>a</code>) to <code class=char>U+006A</code>
199    <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
200    <code>U+0080</code> to <code>U+D7FF</code>, or
201    <code>U+E000</code> to <code>U+10FFFF</code>, or
202    <var>n</var> is equal to <code class=char>U+002D</code>
203    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then
204    replace the <code class=char>U+002D</code>
205    <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
206    character by string <code>\00002D</code>.</li>
207    <li>Then, <var>n</var> is the result of the algorithm.</li>
208    </ol>
209    
210  <p>To  <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize
211  <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize  a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p>
 a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p>  
212  <ol>  <ol>
213  <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>  <li><p>Replace the escape sequences (<code>\</code> and following
214  <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in  characters) in <var>s</var> by characters represented by them
215  <var>gs</var>:  (or an empty string if <code>\</code> is immediately followed by
216    <ol>  newline character(s)) respectively.</p></li>
217    <li>If <var>selector</var> is <em>not</em> the first selector  <li><p>Remove the quotation characters in <var>s</var>
218    in the group of selectors, then append a <code class=char>U+002C</code>  if <var>s</var> is a <code>STRING</code>.</p>
219    <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a  
220    <a href="#newline">newline</a> to <var>result</var>.</li>  <div class="note memo">
221    <li>Append four <code class=char>U+0020</code>  <p>The input <var>s</var> to this algorithm may be an
222    <code class=charname>SPACE</code> characters to <var>result</var>.</li>  <code>IDENT</code>.</p>
223    <li>Process each sequence of simple selectors or  </div></li>
224    combinator in <var>selector</var> by following algorithm:  <li><p>If there is any character that is <em>not</em> one of
225      <dl class=switch>  <code class=char>U+0020</code> <code class=charname>SPACE</code>,
226      <dt>If it is a sequence of simle selector  <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
227      (<dfn id=var-sss><var>sss</var></dfn>)</dt>  (<code class=char>!</code>), <code class=char>U+0023</code>
228        <dd class=ed>@@</dd>  <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to
229      <dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt>  <code class=char>U+005B</code> <code class=charname>LEFT SQUARE
230        <dd>  BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT
231          <ol>  SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or
232          <li>Append two <code class=char>U+0020</code>  <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
233          <code class=charname>SPACE</code> characters to <var>result</var>.</li>  <var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
234          <li>  <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
235            <dl class=switch>  hexadecimal representation of the character.  If the character
236            <dt>If <var>c</var> is descendant combinator (white space)</dt>  is outside the range of <code>[<code class=char>U+0000</code>,
237              <dd>Append a <code class=char>U+0020</code>  <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
238              <code class=charname>SPACE</code> character to  <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</p></li>
239              <var>result</var>.</dd>  <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
240            <dt>If <var>c</var> is child combinator  MARK</code> (<code class=char>"</code>) at the beginning of
241            (<code class=char>></code>)</dt>  <var>s</var>.</p></li>
242              <dd>Append a <code class=char>U+003E</code>  <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
243              <code class=charname>GREATER-THAN SIGN</code>  MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</p></li>
244              (<code class=char>></code>) character to <var>result</var>.</dd>  <li><p>Then, <var>s</var> is the result of the algorithm.</p></li>
           <dt>If <var>c</var> is adjacent sibling combinator  
           (<code class=char>+</code>)</dt>  
             <dd>Append a <code class=char>U+002B</code>  
             <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)  
             character to <var>result</var>.</dd>  
           <dt>If <var>c</var> is general sibling combinator  
           (<code class=char>~</code>)</dt>  
             <dd>Append a <code class=char>U+007E</code>  
             <code class=charname>TILDE</code> (<code class=char>~</code>)  
             character to <var>result</var>.</dd>  
           </dl>  
         </li>  
         <li>Append a <code class=char>U+0020</code>  
         <code class=charname>SPACE</code> character to  
         <var>result</var>.</li>  
         </ol>  
       </dd>  
     </dl>  
   </ol>  
 </li>  
 <li>Then, <var>result</var> is the  
 <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  
 representation of the group of selectors.</li>  
245  </ol>  </ol>
246    
247    <p>A <dfn id=newline title=newline>newline</dfn>
248    <em class=rfc2119>SHOULD</em> be represented as a
249    <code class=char>U+000A</code> <code class=charname>LINE FEED</code>
250    character.  However, depending on the context where
251    the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
252    representation is in use, a sequence of
253    <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
254    followed by a <code class=char>U+000A</code>
255    <code class=charname>LINE FEED</code> (i.e. a
256    <code>CRLF</code> sequence) or a character
257    <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>
258    <em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead.
259    <a href="#newline">Newline</a> representations
260    <em class=rfc2119>SHOULD</em> be consistent in an
261    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
262    representation.</p>
263    
264    <div class="note memo">
265    <p>Therefore, newlines must be normalized before
266    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
267    representations are literally compared.</p>
268    </div>
269    
270    </div>
271    
272    
273    <div class=section id=serializing-simple-selectors>
274    <h3>Serializing Simple Selectors</h3>
275    
276  <p>To  <p>To
277  <dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize  <dfn id=algorithm-serialize-a-simple-selector title="serialize a simple selector">serialize
278  a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>:</p>  a simple selector (<dfn><var id=var-ss>ss</var></dfn>)</dfn>:</p>
# Line 240  a simple selector (<dfn><var id=var-ss>s Line 301  a simple selector (<dfn><var id=var-ss>s
301        </dl>        </dl>
302      </li>      </li>
303      <li>If <var>ss</var> is a type selector, append the      <li>If <var>ss</var> is a type selector, append the
304      <span class=ed>@@ normalized</span> local name to <var>result</var>.</li>      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
305        local name to <var>result</var>.</li>
306      <li>If <var>ss</var> is a universal selector, append      <li>If <var>ss</var> is a universal selector, append
307      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>
308      (<code class=char>*</code>) character to <var>result</var>.</li>      (<code class=char>*</code>) character to <var>result</var>.</li>
309      </ol>      </ol>
310    </dd>    </dd>
311  <dt>If <var>ss</var> is an attribute selector</dt>  <dt>If <var>ss</var> is an attribute selector</dt>
312    <dd class=ed>@@</dd>    <dd>
313        <ol>
314        <li>Append a <code class=char>U+005B</code> <code class=charname>LEFT
315        SQUARE BRACKET</code> (<code class=char>[</code>) to
316        <var>result</var>.</li>
317        <li>
318          Append a namespace prefix as following:
319          <dl>
320          <dt>If a namespace URI is specified</dt>
321            <dd class=ed>@@</dd>
322            <dd class=ed>@@ Current reference implementation is wrong,
323            since its result of sorting depends on namespace prefix.</dd>
324          <dt>If the null namespace is specified</dt>
325            <dd>Append a <code class=char>U+007C</code>
326            <code class=charname>VERTICAL BAR</code> character to
327            <var>result</var>.</dd>
328          <dt>If no namespace is specified</dt>
329            <dd>Append a <code class=char>U+002A</code>
330            <code class=charname>ASTERISK</code> (<code class=char>*</code>)
331            character, followed by a <code class=char>U+007C</code>
332            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
333            character, to <var>result</var>.</dd>
334          </dl>
335        </li>
336        <li>Append the
337        <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
338        local name to <var>result</var>.</li>
339        <li>If a value is specified in <var>ss</var>:
340          <ol>
341          <li>Depending on the way to match, append <code>=</code>,
342          <code>~=</code>, <code>|=</code>, <code>^=</code>,
343          <code>$=</code>, or <code>*=</code> to <var>result</var>.</li>
344          <li>Append the
345          <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
346          value to <var>result</var>.</li>
347          </ol>
348        </li>
349        <li>Append a <code class=char>U+005D</code> <code class=charname>RIGHT
350        SQUARE BRACKET</code> (<code class=char>]</code>) to
351        <var>result</var>.</li>
352        </ol>
353      </dd>
354  <dt>If <var>ss</var> is a class selector</dt>  <dt>If <var>ss</var> is a class selector</dt>
355    <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
356    STOP</code> (<code class=char>.</code>) character, followed    STOP</code> (<code class=char>.</code>) character, followed
357    by <span class=ed>@@ normalized</span> class name,    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
358    <var>result</var>.</dd>    class name, <var>result</var>.</dd>
359  <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>  <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>
360    <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
361    SIGN</code> (<code class=char>#</code>) character, followed    SIGN</code> (<code class=char>#</code>) character, followed
362    by <span class=ed>@@ normalized</span> <abbr>ID</abbr>,    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
363    to <var>result</var>.</dd>    <abbr>ID</abbr>, to <var>result</var>.</dd>
364  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>
365    <dd>    <dd>
366      <ol>      <ol>
367      <li>Append a <code class=char>U+003A</code>      <li>Append a <code class=char>U+003A</code>
368      <code class=charname>COLON</code> (<code class=char>:</code>) character      <code class=charname>COLON</code> (<code class=char>:</code>) character
369      to <var>result</var>.</li>      to <var>result</var>.</li>
370      <li>Append <span class=ed>@@ normalized</span>      <li>Append the
371      pseudo$B!>(Bclass name to <var>result</var>.</li>      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
372        name of the pseudo$B!>(Bclass to <var>result</var>.</li>
373      <li>Append any arguments as following:      <li>Append any arguments as following:
374        <dl class=switch>        <dl class=switch>
375        <dt>If pseudo$B!>(Bclass name is <code>lang</code></dt>        <dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt>
376          <dd>          <dd>
377            <ol>            <ol>
378            <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
379            PARENTHESIS</code> (<code class=char>(</code>) character            PARENTHESIS</code> (<code class=char>(</code>) character
380            to <var>result</var>.</li>            to <var>result</var>.</li>
381            <li>Append <span class=ed>@@ normalized</span>            <li>Append the
382              <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
383            language tag (the argument) to <var>result</var>.</li>            language tag (the argument) to <var>result</var>.</li>
384            <li>Append a <code class=char>U+0029</code>            <li>Append a <code class=char>U+0029</code>
385            <code class=charname>RIGHT PARENTHESIS</code>            <code class=charname>RIGHT PARENTHESIS</code>
# Line 282  a simple selector (<dfn><var id=var-ss>s Line 387  a simple selector (<dfn><var id=var-ss>s
387            to <var>result</var>.</li>            to <var>result</var>.</li>
388            </ol>            </ol>
389          </dd>          </dd>
390        <dt>If pseudo$B!>(Bclass name is <code>-manakai-contains</code></dt>        <dt>If the name of the pseudo$B!>(Bclass is
391          <code>-manakai-contains</code></dt>
392          <dd>          <dd>
393            <ol>            <ol>
394            <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
395            PARENTHESIS</code> (<code class=char>(</code>) character            PARENTHESIS</code> (<code class=char>(</code>) character
396            to <var>result</var>.</li>            to <var>result</var>.</li>
397            <li>Append <span class=ed>@@ normalized</span>            <li>Append the
398              <a href="#algorithm-normalize-a-string" title="normalize a string">normalized</a>
399            string (the argument) to <var>result</var>.</li>            string (the argument) to <var>result</var>.</li>
400            <li>Append a <code class=char>U+0029</code>            <li>Append a <code class=char>U+0029</code>
401            <code class=charname>RIGHT PARENTHESIS</code>            <code class=charname>RIGHT PARENTHESIS</code>
# Line 296  a simple selector (<dfn><var id=var-ss>s Line 403  a simple selector (<dfn><var id=var-ss>s
403            to <var>result</var>.</li>            to <var>result</var>.</li>
404            </ol>            </ol>
405          </dd>          </dd>
406        <dt>If pseudo$B!>(Bclass name is <code>nth-child</code>,        <dt>If name of the pseudo$B!>(Bclass is either <code>nth-child</code>,
407        <code>nth-last-child</code>, <code>nth-of-type</code>, or        <code>nth-last-child</code>, <code>nth-of-type</code>, or
408        <code>nth-last-of-type</code></dt>        <code>nth-last-of-type</code></dt>
409          <dd>          <dd>
# Line 338  a simple selector (<dfn><var id=var-ss>s Line 445  a simple selector (<dfn><var id=var-ss>s
445            to <var>result</var>.</li>            to <var>result</var>.</li>
446            </ol>            </ol>
447          </dd>          </dd>
448        <dt>If pseudo$B!>(Bclass name is <code>not</code></dt>        <dt>If the name of the pseudo$B!>(Bclass is <code>not</code></dt>
449          <dd class=ed>@@</dd>          <dd>
450              <ol>
451                <li>Append a string of <code class=char>U+003A</code>
452                <code class=charname>COLON</code>, <code class=char>U+006E</code>
453                <code class=charname>LATIN SMALL LETTER N</code>,
454                <code class=char>U+006F</code> <code class=charname>LATIN
455                SMALL LETTER O</code>, <code class=char>U+0074</code>
456                <code class=charname>LATIN SMALL LETTER T</code>, and
457                <code class=char>U+0028</code> <code class=charname>LEFT
458                PARENTHESIS</code> (<code>:not(</code>), followed by a
459                <a href="#newline">newline</a>, to <var>result</var>.</li>
460                <li>Append four <code class=char>U+0020</code>
461                <code class=charname>SPACE</code> characters to
462                <var>result</var>.</li>
463                <li>Append four <code class=char>U+0020</code>
464                <code class=charname>SPACE</code> characters to
465                <var>result</var> again.</li>
466                <li><a href="#algorithm-serialize-a-simple-selector">Serialize
467                the simple selector specified as the argument to the
468                <code>not</code> pseudo$B!>(Bclass</a>.</li>
469                <li>Append a <a href="#newline">newline</a> to
470                <var>result</var>.</li>
471                <li>Append four <code class=char>U+0020</code>
472                <code class=charname>SPACE</code> characters to
473                <var>result</var>.</li>
474                <li>Append a <code class=char>U+0029</code>
475                <code class=charname>RIGHT PARENTHESIS</code>
476                (<code class=char>)</code>) character
477                to <var>result</var>.</li>
478              </ol>
479            </dd>
480        </dl>        </dl>
481      </li>      </li>
482      </ol>      </ol>
# Line 350  a simple selector (<dfn><var id=var-ss>s Line 487  a simple selector (<dfn><var id=var-ss>s
487      <li>Append two <code class=char>U+003A</code>      <li>Append two <code class=char>U+003A</code>
488      <code class=charname>COLON</code> characters (<code>::</code>)      <code class=charname>COLON</code> characters (<code>::</code>)
489      to <var>result</var>.</li>      to <var>result</var>.</li>
490      <li>Append <span class=ed>@@ normalized</span>      <li>Append the
491      pseudo$B!>(Belement name to <var>result</var>.</li>      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
492        name of the pseudo$B!>(Belement to <var>result</var>.</li>
493      <!-- For future version: append "(", arguments, ")", if any. -->      <!-- For future version: append "(", arguments, ")", if any. -->
494      </ol>      </ol>
495    </dd>    </dd>
# Line 359  a simple selector (<dfn><var id=var-ss>s Line 497  a simple selector (<dfn><var id=var-ss>s
497    
498  </div>  </div>
499    
500    <div class=section id=serializing-groups-of-selectors>
501    <h3>Serializing Groups of Selectors</h3>
502    
503    <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
504    representation is defined for an invalid group of selectors.</p>
505    
506    <div class="note memo">
507    <p>The serialized representation will not contain any comment.</p>
508    </div>
509    
510    <!-- TODO: link terms to Selectors -->
511    
512    <p>To
513    <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize
514    a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p>
515    <ol>
516    <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>
517    <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in
518    <var>gs</var>:
519      <ol>
520      <li>If <var>selector</var> is <em>not</em> the first selector
521      in the group of selectors, then append a <code class=char>U+002C</code>
522      <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a
523      <a href="#newline">newline</a> to <var>result</var>.</li>
524      <li>Append four <code class=char>U+0020</code>
525      <code class=charname>SPACE</code> characters to <var>result</var>.</li>
526      <li>Process each sequence of simple selectors or
527      combinator in <var>selector</var> by following algorithm:
528        <dl class=switch>
529        <dt>If it is a sequence of simle selector
530        (<dfn id=var-sss><var>sss</var></dfn>)</dt>
531          <dd>
532            <ol>
533            <li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize
534            each simple selector</a> in <var>sss</var>.</li>
535            <li class=ed>sort</li>
536            <li>Append a <a href="#newline">newline</a> to <var>result</var>.</li>
537            </ol>
538          </dd>
539        <dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt>
540          <dd>
541            <ol>
542            <li>Append two <code class=char>U+0020</code>
543            <code class=charname>SPACE</code> characters to <var>result</var>.</li>
544            <li>
545              <dl class=switch>
546              <dt>If <var>c</var> is descendant combinator (white space)</dt>
547                <dd>Append a <code class=char>U+0020</code>
548                <code class=charname>SPACE</code> character to
549                <var>result</var>.</dd>
550              <dt>If <var>c</var> is child combinator
551              (<code class=char>></code>)</dt>
552                <dd>Append a <code class=char>U+003E</code>
553                <code class=charname>GREATER-THAN SIGN</code>
554                (<code class=char>></code>) character to <var>result</var>.</dd>
555              <dt>If <var>c</var> is adjacent sibling combinator
556              (<code class=char>+</code>)</dt>
557                <dd>Append a <code class=char>U+002B</code>
558                <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)
559                character to <var>result</var>.</dd>
560              <dt>If <var>c</var> is general sibling combinator
561              (<code class=char>~</code>)</dt>
562                <dd>Append a <code class=char>U+007E</code>
563                <code class=charname>TILDE</code> (<code class=char>~</code>)
564                character to <var>result</var>.</dd>
565              </dl>
566            </li>
567            <li>Append a <code class=char>U+0020</code>
568            <code class=charname>SPACE</code> character to
569            <var>result</var>.</li>
570            </ol>
571          </dd>
572        </dl>
573      </ol>
574    </li>
575    <li>Then, <var>result</var> is the
576    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
577    representation of <var>gs</var>.</li>
578    </ol>
579    
580    </div>
581    
582    </div>
583    
584  <div class="section" id="parsing">  <div class="section" id="parsing">
585  <h2>Parsing  <h2>Parsing
586  <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
587  Groups of Selectors</h2>  Groups of Selectors</h2>
588    
589  <p>Since <a href="#serializing">the serializing algorithm</a> is  <p>Since <a href="#serializing">the serializing algorithm</a> is
590  so designed that it always output a valid  so designed that it always output a valid
591  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of
592  selectors</a>, no special parser for  selectors</a>, no special parser for the
593  <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
594  is necessary.  Any conforming  representation is necessary.  Any conforming parser for
595  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of  <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of
596  selectors</a> parser <em class=rfc2119>MAY</em> be used  selectors</a> <em class=rfc2119>MAY</em> be used
597  to parse <abbr title="Selectors Serialization Format for Testing">SFFT</abbr>  to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
598  groups of selectors.</p>  representations of groups of selectors.</p>
599  </div>  </div>
600    
601  <div class="section" id="examples">  <div class="section" id="examples">
# Line 451  by choosing <q>Selectors</q> radio butto Line 673  by choosing <q>Selectors</q> radio butto
673    <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>.
674    The latest published version of the specification is available at    The latest published version of the specification is available at
675    <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>
676  <dt id=XBL2>XBL2</dt>  <dt id=ref-XBL2>XBL2</dt>
677    <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>
678    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>.
679    Work in progress.  The latest    Work in progress.  The latest

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24