/[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.13 by wakaba, Mon Oct 22 10:43:33 2007 UTC revision 1.14 by wakaba, Mon Oct 22 10:46:10 2007 UTC
# Line 149  Representation</h2> Line 149  Representation</h2>
149  for now.</p>  for now.</p>
150  </div>  </div>
151    
152  <div class=section id=serializing-groups-of-selectors>  <div class=section id=serializing-tokens>
153  <h3>Serializing Groups of Selectors</h3>  <h3>Serializing Tokens</h3>
154    
155  <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize
156  representation is defined for an invalid group of selectors.</p>  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 <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize
211    a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p>
212    <ol>
213    <li><p>Replace the escape sequences (<code>\</code> and following
214    characters) in <var>s</var> by characters represented by them
215    (or an empty string if <code>\</code> is immediately followed by
216    newline character(s)) respectively.</p></li>
217    <li><p>Remove the quotation characters in <var>s</var>
218    if <var>s</var> is a <code>STRING</code>.</p>
219    
220  <div class="note memo">  <div class="note memo">
221  <p>The serialized representation will not contain any comment.</p>  <p>The input <var>s</var> to this algorithm may be an
222  </div>  <code>IDENT</code>.</p>
223    </div></li>
224    <li><p>If there is any character that is <em>not</em> one of
225    <code class=char>U+0020</code> <code class=charname>SPACE</code>,
226    <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
227    (<code class=char>!</code>), <code class=char>U+0023</code>
228    <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to
229    <code class=char>U+005B</code> <code class=charname>LEFT SQUARE
230    BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT
231    SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or
232    <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in
233    <var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where
234    <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded
235    hexadecimal representation of the character.  If the character
236    is outside the range of <code>[<code class=char>U+0000</code>,
237    <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>
238    <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</p></li>
239    <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
240    MARK</code> (<code class=char>"</code>) at the beginning of
241    <var>s</var>.</p></li>
242    <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION
243    MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</p></li>
244    <li><p>Then, <var>s</var> is the result of the algorithm.</p></li>
245    </ol>
246    
247  <!-- TODO: link terms to Selectors -->  <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  <p>To  <div class="note memo">
265  <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize  <p>Therefore, newlines must be normalized before
 a group of selectors (<dfn id=var-gs><var>gs</var></dfn>)</dfn>:</p>  
 <ol>  
 <li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li>  
 <li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in  
 <var>gs</var>:  
   <ol>  
   <li>If <var>selector</var> is <em>not</em> the first selector  
   in the group of selectors, then append a <code class=char>U+002C</code>  
   <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a  
   <a href="#newline">newline</a> to <var>result</var>.</li>  
   <li>Append four <code class=char>U+0020</code>  
   <code class=charname>SPACE</code> characters to <var>result</var>.</li>  
   <li>Process each sequence of simple selectors or  
   combinator in <var>selector</var> by following algorithm:  
     <dl class=switch>  
     <dt>If it is a sequence of simle selector  
     (<dfn id=var-sss><var>sss</var></dfn>)</dt>  
       <dd>  
         <ol>  
         <li class=ed><a href="#algorithm-serialize-a-simple-selector">Serialize  
         each simple selector</a> in <var>sss</var>.</li>  
         <li class=ed>sort</li>  
         <li>Append a <a href="#newline">newline</a> to <var>result</var>.</li>  
         </ol>  
       </dd>  
     <dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt>  
       <dd>  
         <ol>  
         <li>Append two <code class=char>U+0020</code>  
         <code class=charname>SPACE</code> characters to <var>result</var>.</li>  
         <li>  
           <dl class=switch>  
           <dt>If <var>c</var> is descendant combinator (white space)</dt>  
             <dd>Append a <code class=char>U+0020</code>  
             <code class=charname>SPACE</code> character to  
             <var>result</var>.</dd>  
           <dt>If <var>c</var> is child combinator  
           (<code class=char>></code>)</dt>  
             <dd>Append a <code class=char>U+003E</code>  
             <code class=charname>GREATER-THAN SIGN</code>  
             (<code class=char>></code>) character to <var>result</var>.</dd>  
           <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  
266  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
267  representation of <var>gs</var>.</li>  representations are literally compared.</p>
268  </ol>  </div>
269    
270  </div>  </div>
271    
272    
273  <div class=section id=serializing-simple-selectors>  <div class=section id=serializing-simple-selectors>
274  <h3>Serializing Simple Selectors</h3>  <h3>Serializing Simple Selectors</h3>
275    
# Line 458  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-tokens>  <div class=section id=serializing-groups-of-selectors>
501  <h3>Serializing Tokens</h3>  <h3>Serializing Groups of Selectors</h3>
   
 <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize  
 an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>:</p>  
 <ol>  
 <li>Replace the escape sequences (<code>\</code> and following  
 characters) in <var>n</var> by characters represented by them  
 respectively.</li>  
 <li>If there is any character that is <em>not</em> one of  
 <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>  
 (<code class=char>-</code>), <code class=char>U+0030</code>  
 <code class=charname>DIGIT ZERO</code>  
 (<code class=char>0</code>) to <code class=char>U+0039</code>  
 <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),  
 <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER  
 A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>  
 <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),  
 <code class=char>U+005F</code> <code class=charname>LOW LINE</code>  
 (<code class=char>_</code>), <code class=char>U+0061</code>  
 <code class=charname>LATIN SMALL LETTER A</code>  
 (<code class=char>a</code>) to <code class=char>U+006A</code>  
 <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),  
 <code class=char>U+0080</code> to <code class=char>U+D7FF</code>, or  
 <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in  
 <var>n</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where  
 <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded  
 hexadecimal representation of the character.  If the character  
 is outside the range of <code>[<code class=char>U+0000</code>,  
 <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>  
 <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</li>  
 <li>If the first character in <var>n</var> is one of  
 <code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>  
 (<code class=char>0</code>) to <code class=char>U+0039</code>  
 <code class=charname>DIGIT NINE</code> (<code class=char>9</code>),  
 then prepend a string <code>\00003</code> at the beginning of  
 <var>n</var>.</li>  
 <li>If the first character in <var>n</var> is <code class=char>U+002D</code>  
 <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>) and  
 the second character, if any, is <em>not</em> one of  
 <code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER  
 A</code> (<code class=char>A</code>) to <code class=char>U+005A</code>  
 <code class=charname>LATIN CAPITAL LETTER Z</code> (<code class=char>Z</code>),  
 <code class=char>U+005F</code> <code class=charname>LOW LINE</code>  
 (<code class=char>_</code>), <code class=char>U+0061</code>  
 <code class=charname>LATIN SMALL LETTER A</code>  
 (<code class=char>a</code>) to <code class=char>U+006A</code>  
 <code class=charname>LATIN SMALL LETTER Z</code> (<code class=char>z</code>),  
 <code>U+0080</code> to <code>U+D7FF</code>, or  
 <code>U+E000</code> to <code>U+10FFFF</code>, or  
 <var>n</var> is equal to <code class=char>U+002D</code>  
 <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>), then  
 replace the <code class=char>U+002D</code>  
 <code class=charname>HYPHEN-MINUS</code> (<code class=char>-</code>)  
 character by string <code>\00002D</code>.</li>  
 <li>Then, <var>n</var> is the result of the algorithm.</li>  
 </ol>  
502    
503  <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize  <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
504  a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>:</p>  representation is defined for an invalid group of selectors.</p>
 <ol>  
 <li><p>Replace the escape sequences (<code>\</code> and following  
 characters) in <var>s</var> by characters represented by them  
 (or an empty string if <code>\</code> is immediately followed by  
 newline character(s)) respectively.</p></li>  
 <li><p>Remove the quotation characters in <var>s</var>  
 if <var>s</var> is a <code>STRING</code>.</p>  
505    
506  <div class="note memo">  <div class="note memo">
507  <p>The input <var>s</var> to this algorithm may be an  <p>The serialized representation will not contain any comment.</p>
508  <code>IDENT</code>.</p>  </div>
 </div></li>  
 <li><p>If there is any character that is <em>not</em> one of  
 <code class=char>U+0020</code> <code class=charname>SPACE</code>,  
 <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>  
 (<code class=char>!</code>), <code class=char>U+0023</code>  
 <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) to  
 <code class=char>U+005B</code> <code class=charname>LEFT SQUARE  
 BRACKET</code>, <code class=char>U+005D</code> <code class=charname>RIGHT  
 SQUARE BRACKET</code> to <code class=char>U+D7FF</code>, or  
 <code class=char>U+E000</code> to <code class=char>U+10FFFF</code> in  
 <var>s</var>, then replace it by string <code>\<var>HHHHHH</var></code>, where  
 <dfn id=var-HHHHHH><var>HHHHHH</var></dfn> is the upper$B!>(Bcase zero$B!>(Bpadded  
 hexadecimal representation of the character.  If the character  
 is outside the range of <code>[<code class=char>U+0000</code>,  
 <code class=char>U+10FFFF</code>]</code>, <var>HHHHHH</var>  
 <em class=rfc2119>MUST</em> be <code>FFFFFF</code>.</p></li>  
 <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION  
 MARK</code> (<code class=char>"</code>) at the beginning of  
 <var>s</var>.</p></li>  
 <li><p>Insert a <code class=char>U+0022</code> <code class=charname>QUOTATION  
 MARK</code> (<code class=char>"</code>) at the end of <var>s</var>.</p></li>  
 <li><p>Then, <var>s</var> is the result of the algorithm.</p></li>  
 </ol>  
509    
510  <p>A <dfn id=newline title=newline>newline</dfn>  <!-- TODO: link terms to Selectors -->
 <em class=rfc2119>SHOULD</em> be represented as a  
 <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> (i.e. a  
 <code>CRLF</code> sequence) or a character  
 <code class=char>U+000D</code> <code class=charname>CARRIAGE RETURN</code>  
 <em class=rfc2119>MAY</em> be used as a <a href="#newline">newline</a> instead.  
 <a href="#newline">Newline</a> representations  
 <em class=rfc2119>SHOULD</em> be consistent in an  
 <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  
 representation.</p>  
511    
512  <div class="note memo">  <p>To
513  <p>Therefore, newlines must be normalized before  <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>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
577  representations are literally compared.</p>  representation of <var>gs</var>.</li>
578  </div>  </ol>
579    
580  </div>  </div>
581    

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24