/[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.16 by wakaba, Mon Oct 22 11:16:27 2007 UTC revision 1.18 by wakaba, Sun Oct 28 07:19:15 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-22>22 October 2007</time></h2>  <h2>Working Draft <time datetime=2007-10-28>28 October 2007</time></h2>
14    
15  <dl class="versions-uri">  <dl class="versions-uri">
16  <dt>This Version</dt>  <dt>This Version</dt>
# Line 98  in a tree structure and are used in Web Line 98  in a tree structure and are used in Web
98  <abbr>API</abbr></a>  <abbr>API</abbr></a>
99  <cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p>  <cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p>
100    
101  <div class="issue ed">...</div>  <p>It is so flexible language that a conceptually same pattern
102    can be represented in inifnite numbers of instances of selectors.
103    It might be convinient for e.g. validation of a test result to
104    define a subset of the language, in which no semantically equivalent
105    selectors are contained.</p>
106    
107  <p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The  <p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The
108  <abbr title="Cascading Style Sheets Object Model">CSSOM</abbr>  <abbr title="Cascading Style Sheets Object Model">CSSOM</abbr>
# Line 111  attribute.  However, the algorithm is in Line 115  attribute.  However, the algorithm is in
115  <time datetime=2007-09-25>at the time of the writing</time>.    <time datetime=2007-09-25>at the time of the writing</time>.  
116  Note that current Web browser implementations  Note that current Web browser implementations
117  of the <code>selectorText</code> attribute are consistently broken  of the <code>selectorText</code> attribute are consistently broken
118  in not escaping unsafe identifiers.</p>  in not escaping unsafe identifiers and therefore it is not wise
119    to deploy that format for testing.</p>
120    
121  </div>  </div>
122    
# Line 148  simple selector in a selector.</p> Line 153  simple selector in a selector.</p>
153  </div>  </div>
154    
155  <div class="section" id="serializing">  <div class="section" id="serializing">
156  <h2>Serializing Selectors as  <h2>Serializing Selectors in
157  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
158  Representation</h2>  Representation</h2>
159    
# Line 170  also the reference implementation</a> fo Line 175  also the reference implementation</a> fo
175  <div class=section id=serializing-tokens>  <div class=section id=serializing-tokens>
176  <h3>Serializing Tokens</h3>  <h3>Serializing Tokens</h3>
177    
178  <p>To <dfn id=algorithm-normalize-an-ident title="normalize an IDENT">normalize  <p>To <dfn id=algorithm-normalize-an-ident title="normalize a string as an IDENT">normalize
179  an <code>IDENT</code> (<dfn id=var-n><var>n</var></dfn>)</dfn>,  a string (<dfn id=var-n><var>n</var></dfn>) as an <code>IDENT</code></dfn>,
180  the following algorithm <em class=rfc2119>MUST</em> be used:</p>  the following algorithm <em class=rfc2119>MUST</em> be used:</p>
181  <ol>  <ol>
182  <li>Replace the escape sequences (<code>\</code> and following  <li>If <var>n</var> is either an <code>IDENT</code> or a <code>HASH</code>,
183  characters) in <var>n</var> by characters represented by them  replace the escape sequences (<code>\</code> and following characters) in
184  respectively.</li>  <var>n</var> by characters represented by them respectively.</li>
185    <li>If <var>n</var> is a <code>HASH</code>, remove the leading
186    <code class=char>U+0023</code> <code class=charname>NUMBER SIGN</code>
187    (<code class=char>#</code>) character from <var>n</var>.</li>
188  <li>If there is any character that is <em>not</em> one of  <li>If there is any character that is <em>not</em> one of
189  <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>  <code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
190  (<code class=char>-</code>), <code class=char>U+0030</code>  (<code class=char>-</code>), <code class=char>U+0030</code>
# Line 226  character by string <code>\00002D</code> Line 234  character by string <code>\00002D</code>
234  <li>Then, <var>n</var> is the result of the algorithm.</li>  <li>Then, <var>n</var> is the result of the algorithm.</li>
235  </ol>  </ol>
236    
237  <p>To <dfn id=algorithm-normalize-a-string title="normalize a STRING">normalize  <p>To <dfn id=algorithm-normalize-a-string title="normalize a string (STRING or IDENT) as a STRING">normalize
238  a <code>STRING</code> (<dfn id=var-s><var>s</var></dfn>)</dfn>,  a string (<dfn id=var-s><var>s</var></dfn>) as a <code>STRING</code></dfn>,
239  the following algorithm <em class=rfc2119>MUST</em> be used:</p>  the following algorithm <em class=rfc2119>MUST</em> be used:</p>
240  <ol>  <ol>
241  <li><p>Replace the escape sequences (<code>\</code> and following  <li>If <var>s</var> is either an <code>IDENT</code> or a
242  characters) in <var>s</var> by characters represented by them  <code>STRING</code>, replace the escape sequences (<code>\</code> and
243    following characters) in <var>s</var> by characters represented by them
244  (or an empty string if <code>\</code> is immediately followed by  (or an empty string if <code>\</code> is immediately followed by
245  newline character(s)) respectively.</p></li>  newline character(s)) respectively.</li>
246  <li><p>Remove the quotation characters in <var>s</var>  <li>If <var>s</var> is a <code>STRING</code>, remove the quotation marks
247  if <var>s</var> is a <code>STRING</code>.</p>  enclosing <var>s</var>.</li>
   
 <div class="note memo">  
 <p>The input <var>s</var> to this algorithm may be an  
 <code>IDENT</code>.</p>  
 </div></li>  
248  <li><p>If there is any character that is <em>not</em> one of  <li><p>If there is any character that is <em>not</em> one of
249  <code class=char>U+0020</code> <code class=charname>SPACE</code>,  <code class=char>U+0020</code> <code class=charname>SPACE</code>,
250  <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>  <code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
# Line 287  representation.</p> Line 291  representation.</p>
291  representations are literally compared.</p>  representations are literally compared.</p>
292  </div>  </div>
293    
294    <div class="issue ed">
295    <p>Need to define <dfn id=lower-case>lower$B!>(Bcase</dfn>.
296    It is tr/A-Z/a-z/ for now.</p>
297    </div>
298    
299  </div>  </div>
300    
301    
# Line 309  the following algorithm <em class=rfc211 Line 318  the following algorithm <em class=rfc211
318  <dt>If <var>ss</var> is a type or universal selector</dt>  <dt>If <var>ss</var> is a type or universal selector</dt>
319    <dd>    <dd>
320      <ol>      <ol>
321      <li>      <li>Append a namespace prefix as following:
322    
323        <dl class=switch>        <dl class=switch>
324        <dt>If a namespace URI is specified (via namespace prefix, or        <dt>If a namespace URI is specified (via namespace prefix, or
325        by omitting namespace prefix where a default namespace is specified)</dt>        by omitting namespace prefix where a default namespace is specified)</dt>
326          <dd class="ed">@@</dd>          <dd>Append the namespace URI as a
327            <a href="#algorithm-normalize-an-ident" title="normalize a string as an IDENT">normalized
328            <code>IDENT</code></a> to <var>r</var>.  Then, append a
329            <code class=char>U+007C</code>
330            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
331            character to <var>r</var>.</dd>
332        <dt>If the null namespace is specified (by zero$B!>(Blength namespace        <dt>If the null namespace is specified (by zero$B!>(Blength namespace
333        prefix)</dt>        prefix)</dt>
334          <dd>Append a <code class=char>U+007C</code>          <dd>Append a <code class=char>U+007C</code>
# Line 330  the following algorithm <em class=rfc211 Line 345  the following algorithm <em class=rfc211
345        </dl>        </dl>
346      </li>      </li>
347      <li>If <var>ss</var> is a type selector, append the      <li>If <var>ss</var> is a type selector, append the
348      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>      <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) an IDENT">normalized</a>
349      local name to <var>r</var>.</li>      local name to <var>r</var>.</li>
350      <li>If <var>ss</var> is a universal selector, append      <li>If <var>ss</var> is a universal selector, append
351      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>      a <code class=char>U+002A</code> <code class=charname>ASTERISK</code>
# Line 347  the following algorithm <em class=rfc211 Line 362  the following algorithm <em class=rfc211
362        Append a namespace prefix as following:        Append a namespace prefix as following:
363        <dl>        <dl>
364        <dt>If a namespace URI is specified</dt>        <dt>If a namespace URI is specified</dt>
365          <dd class=ed>@@</dd>          <dd>Append the namespace URI as a
366          <dd class=ed>@@ Current reference implementation is wrong,          <a href="#algorithm-normalize-an-ident" title="normalize a string as an IDENT">normalized
367          since its result of sorting depends on namespace prefix.</dd>          <code>IDENT</code></a> to <var>r</var>.  Then, append a
368            <code class=char>U+007C</code>
369            <code class=charname>VERTICAL BAR</code> (<code class=char>|</code>)
370            character to <var>r</var>.</dd>
371        <dt>If the null namespace is specified</dt>        <dt>If the null namespace is specified</dt>
372          <dd>Append a <code class=char>U+007C</code>          <dd>Append a <code class=char>U+007C</code>
373          <code class=charname>VERTICAL BAR</code> character to          <code class=charname>VERTICAL BAR</code> character to
# Line 363  the following algorithm <em class=rfc211 Line 381  the following algorithm <em class=rfc211
381        </dl>        </dl>
382      </li>      </li>
383      <li>Append the      <li>Append the
384      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>      <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a>
385      local name to <var>r</var>.</li>      local name to <var>r</var>.</li>
386      <li>If a value is specified in <var>ss</var>:      <li>If a value is specified in <var>ss</var>:
387        <ol>        <ol>
# Line 383  the following algorithm <em class=rfc211 Line 401  the following algorithm <em class=rfc211
401  <dt>If <var>ss</var> is a class selector</dt>  <dt>If <var>ss</var> is a class selector</dt>
402    <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
403    STOP</code> (<code class=char>.</code>) character, followed    STOP</code> (<code class=char>.</code>) character, followed
404    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>    by <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a>
405    class name, to <var>r</var>.</dd>    class name, to <var>r</var>.</dd>
406  <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>  <dt>If <var>ss</var> is an <abbr>ID</abbr> selector</dt>
407    <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
408    SIGN</code> (<code class=char>#</code>) character, followed    SIGN</code> (<code class=char>#</code>) character, followed
409    by <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>    by <a href="#algorithm-normalize-an-ident" title="normalize a string (HASH except for the leading #) as an IDENT">normalized</a>
410    <abbr>ID</abbr>, to <var>r</var>.</dd>    <abbr>ID</abbr>, to <var>r</var>.</dd>
411  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>  <dt>If <var>ss</var> is a pseudo$B!>(Bclass selector</dt>
412    <dd>    <dd>
# Line 397  the following algorithm <em class=rfc211 Line 415  the following algorithm <em class=rfc211
415      <code class=charname>COLON</code> (<code class=char>:</code>) character      <code class=charname>COLON</code> (<code class=char>:</code>) character
416      to <var>r</var>.</li>      to <var>r</var>.</li>
417      <li>Append the      <li>Append the
418      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>      <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a>
419      name of the pseudo$B!>(Bclass to <var>r</var>.</li>      name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Bclass to
420        <var>r</var>.</li>
421      <li>Append any arguments as following:      <li>Append any arguments as following:
422        <dl class=switch>        <dl class=switch>
423        <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 408  the following algorithm <em class=rfc211 Line 427  the following algorithm <em class=rfc211
427            PARENTHESIS</code> (<code class=char>(</code>) character            PARENTHESIS</code> (<code class=char>(</code>) character
428            to <var>r</var>.</li>            to <var>r</var>.</li>
429            <li>Append the            <li>Append the
430            <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>            <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a>
431            language tag (the argument) to <var>r</var>.</li>            language tag (the argument) to <var>r</var>.
432              <span class="issue ed">Should we normalize cases?</span></li>
433            <li>Append a <code class=char>U+0029</code>            <li>Append a <code class=char>U+0029</code>
434            <code class=charname>RIGHT PARENTHESIS</code>            <code class=charname>RIGHT PARENTHESIS</code>
435            (<code class=char>)</code>) character            (<code class=char>)</code>) character
# Line 523  the following algorithm <em class=rfc211 Line 543  the following algorithm <em class=rfc211
543      <code class=charname>COLON</code> characters (<code>::</code>)      <code class=charname>COLON</code> characters (<code>::</code>)
544      to <var>r</var>.</li>      to <var>r</var>.</li>
545      <li>Append the      <li>Append the
546      <a href="#algorithm-normalize-an-ident" title="normalize an IDENT">normalized</a>      <a href="#algorithm-normalize-an-ident" title="normalize a string (IDENT) as an IDENT">normalized</a>
547      name of the pseudo$B!>(Belement to <var>r</var>.</li>      name (in <a href="#lower-case">lower$B!>(Bcase</a>) of the pseudo$B!>(Belement
548        to <var>r</var>.</li>
549      <li>If the pseudo$B!>(Belement has any arguments:      <li>If the pseudo$B!>(Belement has any arguments:
550          The pseudo$B!>(Belement is not supported by this version of          The pseudo$B!>(Belement is not supported by this version of
551          <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>          <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
# Line 547  representation of <var>ss</var>.</li> Line 568  representation of <var>ss</var>.</li>
568  <h3>Serializing Groups of Selectors</h3>  <h3>Serializing Groups of Selectors</h3>
569    
570  <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <p>No <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
571  representation is defined for an invalid group of selectors.</p>  representation is defined for an invalid
572    <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of
573    selectors</a>.</p>
574    
575  <p>To  <p>To
576  <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize  <dfn id=algorithm-serialize-a-group-of-selectors title="serialize a group of selectors">serialize
# Line 559  the following algorithm <em class=rfc211 Line 582  the following algorithm <em class=rfc211
582  <var>gs</var>:  <var>gs</var>:
583    <ol>    <ol>
584    <li>If <var>selector</var> is <em>not</em> the first selector    <li>If <var>selector</var> is <em>not</em> the first selector
585    in the group of selectors, then append a <code class=char>U+002C</code>    in the <var>gs</var>, then append a <code class=char>U+002C</code>
586    <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a    <code class=charname>COMMA</code> (<code class=char>,</code>) followed by a
587    <a href="#newline">newline</a> to <var>result</var>.</li>    <a href="#newline">newline</a> to <var>result</var>.</li>
588    <li>Append four <code class=char>U+0020</code>    <li>Append four <code class=char>U+0020</code>
# Line 626  representation of <var>gs</var>.</li> Line 649  representation of <var>gs</var>.</li>
649  <div class="section" id="parsing">  <div class="section" id="parsing">
650  <h2>Parsing  <h2>Parsing
651  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
652  Groups of Selectors</h2>  Representations of Selectors</h2>
653    
654  <p>Since <a href="#serializing">the serializing algorithm</a> is  <p>Since <a href="#algorithm-serialize-a-group-of-selectors">the serializing
655  so designed that it always output a valid  algorithm for groups of selectors</a> is so designed that it always outputs a
656  <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of  valid <a href="http://www.w3.org/TR/css3-selectors/#grouping">group of
657  selectors</a>, no special parser for the  selectors</a>, no special parser for the
658  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
659  representation is necessary.  Any conforming parser for  representation is necessary.  Any conforming parser for
660  <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of  <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of
661  selectors</a> <em class=rfc2119>MAY</em> be used  selectors</a> <em class=rfc2119>MAY</em> be used
662  to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>  to parse <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
663  representations of groups of selectors.</p>  representations of
664    <a href="http://www.w3.org/TR/css3-selectors/#grouping">groups of
665    selectors</a>.</p>
666    
667    <p>Likewise, <a href="#algorithm-serialize-a-simple-selector">the serializing
668    algorithm for simple selectors</a> always outputs a valid
669    <a href="#simple-selector">simple selector</a> and therefore any
670    conforming parser for <a href="#simple-selector">simple selector</a>
671    <em class=rfc2119>MAY</em> be used to parse
672    <abbr title="Selectors Serialization Format for Testing">SSFT</abbr>
673    representations of <a href="#simple-selector">simple selectors</a>.</p>
674  </div>  </div>
675    
676  <div class="section" id="examples">  <div class="section" id="examples">
# Line 673  by choosing <q>Selectors</q> radio butto Line 706  by choosing <q>Selectors</q> radio butto
706    <a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr>    <a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr>
707    14</a>, <abbr title="Request for Comments">RFC</abbr> 2119,    14</a>, <abbr title="Request for Comments">RFC</abbr> 2119,
708    <time datetime=1997-03>March 1997</time>.    <time datetime=1997-03>March 1997</time>.
709    This version of the specification is referenced</dd>    This version of the specification is referenced.</dd>
710  <dt id=ref-SELECTORS>SELECTORS</dt>  <dt id=ref-SELECTORS>SELECTORS</dt>
711    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>,    <dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>,
712    <abbr title="World Wide Web Consortium">W3C</abbr> Working Draft,    <abbr title="World Wide Web Consortium">W3C</abbr> Working Draft,

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.18

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24