/[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.8 by wakaba, Mon Oct 15 00:32:05 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-15>15 October 2007</time></h2>  <h2>Working Draft <time datetime=2007-10-22>22 October 2007</time></h2>
14    
15  <dl class="versions-uri">  <dl class="versions-uri">
16  <dt>This Version</dt>  <dt>This Version</dt>
# 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>
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$B!>(Bnormative,  <p>All examples and notes in this specification are non$B!>(Bnormative,
141  as are all sections explicitly marked non$B!>(Bnormative.  Everything  as are all sections explicitly marked non$B!>(Bnormative.  Everything
# Line 138  simple selector in a selector.</p> Line 148  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    
 <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  
 representation is defined for an invalid group of selectors.</p>  
   
160  <div class="note memo">  <div class="note memo">
161  <p>The serialized representation will not contain any comment.</p>  <p>The serialized representation will not contain any comment.</p>
162  </div>  </div>
   
163  <!-- TODO: link terms to Selectors -->  <!-- TODO: link terms to Selectors -->
164    
165  <p>To  <div class=section id=serializing-tokens>
166  <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize  <h3>Serializing Tokens</h3>
167  a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p>  
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>  <ol>
172  <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>  <li>Replace the escape sequences (<code>\</code> and following
173  <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in  characters) in <var>n</var> by characters represented by them
174  <var>gs</var>:  respectively.</li>
175    <ol>  <li>If there is any character that is <em>not</em> one of
176    <li>If <var>selector</var> is <em>not</em> the first selector  <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
177    in the group of selectors, then append a <code class=char>U+002C</code>  (<code class=char>-</code>), <code class=char>U+0030</code>
178    <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a  <code class=charname>DIGIT ZERO</code>
179    <a href="#newline">newline</a> to <var>result</var>.</li>  (<code class=char>0</code>) to <code class=char>U+0039</code>
180    <li>Append four <code class=char>U+0020</code>  <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
181    <code class=charname>SPACE</code> characters to <var>result</var>.</li>  <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
182    <li>Process each sequence of simple selectors or  A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
183    combinator in <var>selector</var> by following algorithm:  <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
184      <dl class=switch>  <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
185      <dt>If it is a sequence of simle selector  (<code class=char>_</code>), <code class=char>U+0061</code>
186      (<dfn id=var-sss><var>sss</var></dfn>)</dt>  <code class=charname>LATIN SMALL LETTER A</code>
187        <dd class=ed>@@</dd>  (<code class=char>a</code>) to <code class=char>U+006A</code>
188      <dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt>  <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
189        <dd>  <code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or
190          <ol>  <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
191          <li>Append two <code class=char>U+0020</code>  <var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
192          <code class=charname>SPACE</code> characters to <var>result</var>.</li>  <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
193          <li>  hexadecimal representation of the character.  If the character
194            <dl class=switch>  is outside the range of <code>[<code class=char>U+0000</code>,
195            <dt>If <var>c</var> is descendant combinator (white space)</dt>  <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
196              <dd>Append a <code class=char>U+0020</code>  <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>
197              <code class=charname>SPACE</code> character to  <li>If the first character in <var>n</var> is one of
198              <var>result</var>.</dd>  <code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>
199            <dt>If <var>c</var> is child combinator  (<code class=char>0</code>) to <code class=char>U+0039</code>
200            (<code class=char>></code>)</dt>  <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),
201              <dd>Append a <code class=char>U+003E</code>  then prepend a string <code>\00003</code> at the beginning of
202              <code class=charname>GREATER-THAN SIGN</code>  <var>n</var>.</li>
203              (<code class=char>></code>) character to <var>result</var>.</dd>  <li>If the first character in <var>n</var> is <code class=char>U+002D</code>
204            <dt>If <var>c</var> is adjacent sibling combinator  <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and
205            (<code class=char>+</code>)</dt>  the second character, if any, is <em>not</em> one of
206              <dd>Append a <code class=char>U+002B</code>  <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
207              <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)  A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>
208              character to <var>result</var>.</dd>  <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),
209            <dt>If <var>c</var> is general sibling combinator  <code class=char>U+005F</code> <code class=charname>LOW LINE</code>
210            (<code class=char>~</code>)</dt>  (<code class=char>_</code>), <code class=char>U+0061</code>
211              <dd>Append a <code class=char>U+007E</code>  <code class=charname>LATIN SMALL LETTER A</code>
212              <code class=charname>TILDE</code> (<code class=char>~</code>)  (<code class=char>a</code>) to <code class=char>U+006A</code>
213              character to <var>result</var>.</dd>  <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),
214            </dl>  <code>U+0080</code> to <code>U+D7FF</code>, or
215          </li>  <code>U+E000</code> to <code>U+10FFFF</code>, or
216          <li>Append a <code class=char>U+0020</code>  <var>n</var> is equal to <code class=char>U+002D</code>
217          <code class=charname>SPACE</code> character to  <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then
218          <var>result</var>.</li>  replace the <code class=char>U+002D</code>
219          </ol>  <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)
220        </dd>  character by string <code>\00002D</code>.</li>
221      </dl>  <li>Then, <var>n</var> is the result of the algorithm.</li>
222    </ol>  </ol>
223  </li>  
224  <li>Then, <var>result</var> is the  <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize
225  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>,
226  representation of <var>gs</var>.</li>  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>  </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  <p>To
295  <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
296  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>,
297    the following algorithm <em class=rfc2119>MUST</em> be used:</p>
298  <dl class=switch>  <dl class=switch>
299  <dt>If <var>ss</var> is a type or universal selector</dt>  <dt>If <var>ss</var> is a type or universal selector</dt>
300    <dd>    <dd>
# Line 243  a simple selector (<dfn><var id=var-ss>s Line 320  a simple selector (<dfn><var id=var-ss>s
320        </dl>        </dl>
321      </li>      </li>
322      <li>If <var>ss</var> is a type selector, append the      <li>If <var>ss</var> is a type selector, append the
323      <span class=ed>@@ normalized</span> local name to <var>result</var>.</li>      <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      <li>If <var>ss</var> is a universal selector, append
326      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>
327      (<code class=char>*</code>) character to <var>result</var>.</li>      (<code class=char>*</code>) character to <var>result</var>.</li>
328      </ol>      </ol>
329    </dd>    </dd>
330  <dt>If <var>ss</var> is an attribute selector</dt>  <dt>If <var>ss</var> is an attribute selector</dt>
331    <dd class=ed>@@</dd>    <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>  <dt>If <var>ss</var> is a class selector</dt>
374    <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
375    STOP</code> (<code class=char>.</code>) character, followed    STOP</code> (<code class=char>.</code>) character, followed
376    by <span class=ed>@@ normalized</span> class name,    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
377    <var>result</var>.</dd>    class name, <var>result</var>.</dd>
378  <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>  <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    <dd>Append a <code class=char>U+0023</code> <code class=charname>NUMBER
380    SIGN</code> (<code class=char>#</code>) character, followed    SIGN</code> (<code class=char>#</code>) character, followed
381    by <span class=ed>@@ normalized</span> <abbr>ID</abbr>,    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>
382    to <var>result</var>.</dd>    <abbr>ID</abbr>, to <var>result</var>.</dd>
383  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>
384    <dd>    <dd>
385      <ol>      <ol>
386      <li>Append a <code class=char>U+003A</code>      <li>Append a <code class=char>U+003A</code>
387      <code class=charname>COLON</code> (<code class=char>:</code>) character      <code class=charname>COLON</code> (<code class=char>:</code>) character
388      to <var>result</var>.</li>      to <var>result</var>.</li>
389      <li>Append the <span class=ed>@@ normalized</span> name of the      <li>Append the
390      pseudo$B!>(Bclass to <var>result</var>.</li>      <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:      <li>Append any arguments as following:
393        <dl class=switch>        <dl class=switch>
394        <dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt>        <dt>If the name of the pseudo$B!>(Bclass is <code>lang</code></dt>
# Line 277  a simple selector (<dfn><var id=var-ss>s Line 397  a simple selector (<dfn><var id=var-ss>s
397            <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
398            PARENTHESIS</code> (<code class=char>(</code>) character            PARENTHESIS</code> (<code class=char>(</code>) character
399            to <var>result</var>.</li>            to <var>result</var>.</li>
400            <li>Append <span class=ed>@@ normalized</span>            <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>            language tag (the argument) to <var>result</var>.</li>
403            <li>Append a <code class=char>U+0029</code>            <li>Append a <code class=char>U+0029</code>
404            <code class=charname>RIGHT PARENTHESIS</code>            <code class=charname>RIGHT PARENTHESIS</code>
# Line 292  a simple selector (<dfn><var id=var-ss>s Line 413  a simple selector (<dfn><var id=var-ss>s
413            <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
414            PARENTHESIS</code> (<code class=char>(</code>) character            PARENTHESIS</code> (<code class=char>(</code>) character
415            to <var>result</var>.</li>            to <var>result</var>.</li>
416            <li>Append <span class=ed>@@ normalized</span>            <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>            string (the argument) to <var>result</var>.</li>
419            <li>Append a <code class=char>U+0029</code>            <li>Append a <code class=char>U+0029</code>
420            <code class=charname>RIGHT PARENTHESIS</code>            <code class=charname>RIGHT PARENTHESIS</code>
# Line 384  a simple selector (<dfn><var id=var-ss>s Line 506  a simple selector (<dfn><var id=var-ss>s
506      <li>Append two <code class=char>U+003A</code>      <li>Append two <code class=char>U+003A</code>
507      <code class=charname>COLON</code> characters (<code>::</code>)      <code class=charname>COLON</code> characters (<code>::</code>)
508      to <var>result</var>.</li>      to <var>result</var>.</li>
509      <li>Append the <span class=ed>@@ normalized</span> name of the      <li>Append the
510      pseudo$B!>(Belement to <var>result</var>.</li>      <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. -->      <!-- For future version: append "(", arguments, ")", if any. -->
513      </ol>      </ol>
514    </dd>    </dd>
515  </dl>  </dl>
516    
517    </div>
518    
519  <p>A <dfn id=newline title=newline>newline</dfn>  <div class=section id=serializing-groups-of-selectors>
520  <em class=rfc2119>SHOULD</em> be represented as a  <h3>Serializing Groups of Selectors</h3>
 <code class=char>U+000A</code> <code class=charname>LINE FEED</code>  
 character.  However, depending on the context where  
 the <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  
 representation is in use, a sequence of  
 <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>  
 followed by a <code class=char>U+000A</code>  
 <code class=charname>LINE FEED</code> or a character  
 <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>  
 <em class=rfc2119>MAY</em> be used as a newline instead.</p>  
521    
522  <div class="note memo">  <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
523  <p>Therefore, when  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>
530    <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
532    <var>gs</var>:
533      <ol>
534      <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>
536      <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a
537      <a href="#newline">newline</a> to <var>result</var>.</li>
538      <li>Append four <code class=char>U+0020</code>
539      <code class=charname>SPACE</code> characters to <var>result</var>.</li>
540      <li>Process each sequence of simple selectors or
541      combinator in <var>selector</var> by following algorithm:
542        <dl class=switch>
543        <dt>If it is a sequence of simle selector
544        (<dfn id=var-sss><var>sss</var></dfn>)</dt>
545          <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>
554          <dd>
555            <ol>
556            <li>Append two <code class=char>U+0020</code>
557            <code class=charname>SPACE</code> characters to <var>result</var>.</li>
558            <li>
559              <dl class=switch>
560              <dt>If <var>c</var> is descendant combinator (white space)</dt>
561                <dd>Append a <code class=char>U+0020</code>
562                <code class=charname>SPACE</code> character to
563                <var>result</var>.</dd>
564              <dt>If <var>c</var> is child combinator
565              (<code class=char>></code>)</dt>
566                <dd>Append a <code class=char>U+003E</code>
567                <code class=charname>GREATER-THAN SIGN</code>
568                (<code class=char>></code>) character to <var>result</var>.</dd>
569              <dt>If <var>c</var> is adjacent sibling combinator
570              (<code class=char>+</code>)</dt>
571                <dd>Append a <code class=char>U+002B</code>
572                <code class=charname>PLUS SIGN</code> (<code class=char>+</code>)
573                character to <var>result</var>.</dd>
574              <dt>If <var>c</var> is general sibling combinator
575              (<code class=char>~</code>)</dt>
576                <dd>Append a <code class=char>U+007E</code>
577                <code class=charname>TILDE</code> (<code class=char>~</code>)
578                character to <var>result</var>.</dd>
579              </dl>
580            </li>
581            <li>Append a <code class=char>U+0020</code>
582            <code class=charname>SPACE</code> character to
583            <var>result</var>.</li>
584            </ol>
585          </dd>
586        </dl>
587      </ol>
588    </li>
589    <li>Then, <var>result</var> is the
590  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
591  representations are literally compared, newlines must be normalized.</p>  representation of <var>gs</var>.</li>
592    </ol>
593    
594  </div>  </div>
595    
596  </div>  </div>
# Line 504  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.8  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24