1 |
<!DOCTYPE html> |
2 |
<html lang="en" class="formal-specification status-work-in-progress"> |
3 |
<head> |
4 |
<title>Selectors Serialization Format for Testing (SSFT) Specification</title> |
5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
6 |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
7 |
</head> |
8 |
<body class="has-abstract"> |
9 |
|
10 |
<div class="header"> |
11 |
<h1>Selectors Serialization Format for Testing (<abbr>SSFT</abbr>) |
12 |
Specification</h1> |
13 |
<h2>Working Draft 25 September 2007</h2> |
14 |
|
15 |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
17 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/selectors/ssft/ssft" |
18 |
>http://suika.fam.cx/www/markup/selectors/ssft/ssft</a>></code></dd> |
19 |
<dt>Latest Version</dt> |
20 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/selectors/ssft/ssft" |
21 |
>http://suika.fam.cx/www/markup/selectors/ssft/ssft</a>></code></dd> |
22 |
<!-- |
23 |
<dt>Latest Working Draft</dt> |
24 |
--> |
25 |
<!-- <dt>Previous Version</dt> --> |
26 |
</dl> |
27 |
<dl class="authors" id="author"> |
28 |
<dt>Author</dt> |
29 |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
30 |
lang=ja>Wakaba</a> |
31 |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
32 |
>w@suika.fam.cx</a>></code></dd> |
33 |
</dl> |
34 |
|
35 |
<p class="copyright" lang="en">© 2007 <a |
36 |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
37 |
Permission is granted to copy, distribute and/or modify this document |
38 |
under the terms of the <a rel="license" |
39 |
href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>, |
40 |
Version 1.2 |
41 |
or any later version published by the <a |
42 |
href="http://www.fsf.org/">Free Software Foundation</a>; |
43 |
with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover |
44 |
Texts. A copy of the license is |
45 |
available at <code class="URI"><<a |
46 |
href="http://www.gnu.org/copyleft/fdl.html" |
47 |
rel="license">http://www.gnu.org/copyleft/fdl.html</a>></code>.</p> |
48 |
</div> |
49 |
|
50 |
<div id="abstract" class="section"> |
51 |
<h2>Abstract</h2> |
52 |
|
53 |
<div class="ed issue">...</div> |
54 |
|
55 |
</div> |
56 |
|
57 |
<div id="status" class="section"> |
58 |
<h2>Status of This Document</h2> |
59 |
|
60 |
<p><em>This section describes the status of this document |
61 |
at the time of its publication. Other documents |
62 |
might supersede this document.</em></p> |
63 |
|
64 |
<p>This document is a working draft. |
65 |
It might be updated, replaced, or obsoleted by |
66 |
other documents at any time. It is inappropriate to |
67 |
cite this document as other than <q>work in progress</q>.</p> |
68 |
|
69 |
<p>Comments on this document are welcome and |
70 |
may be sent to the <a href="#author">author</a>.</p> |
71 |
|
72 |
<p>Translations of thie document might be available. |
73 |
The English version of the document is the only |
74 |
normative version.</p> |
75 |
</div> |
76 |
|
77 |
<div id="introduction" class="section"> |
78 |
<h2>Introduction</h2> |
79 |
|
80 |
<p>This section is <em>informative</em>.</p> |
81 |
|
82 |
<div class="issue ed">...</div> |
83 |
|
84 |
<p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The |
85 |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
86 |
specification</a> |
87 |
<cite class="bibref informative">[<a href="#bib-CSSOM">CSSOM</a>]</cite> |
88 |
is trying to define an algorithm to |
89 |
<a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&content-type=text/html;%20charset=utf-8#serializing0">serialize |
90 |
a group of selectors</a> for the purpose of <code>selectorText</code> |
91 |
attribute. However, the algorithm is incomplete |
92 |
at the time of the writing. Note that current Web browser implementations |
93 |
of the <code>selectorText</code> attribute are consistently broken |
94 |
in not escaping unsafe identifiers.</p> |
95 |
|
96 |
</div> |
97 |
|
98 |
<div class="section" id="terminology"> |
99 |
<h2>Terminology</h2> |
100 |
|
101 |
<p>The key words <q><em class="rfc2119">MUST</em></q>, |
102 |
<q><em class="rfc2119">MUST NOT</em></q>, |
103 |
<q><em class="rfc2119">SHOULD</em></q>, |
104 |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
105 |
<q><em class=rfc2119>MAY</em></q> in this |
106 |
document are to be interpreted as described in |
107 |
<abbr title="Request for Comments">RFC</abbr> 2119 |
108 |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
109 |
</div> |
110 |
|
111 |
<div class="section" id="serializing"> |
112 |
<h2>Serializing Groups of Selectors</h2> |
113 |
|
114 |
<div class="issue ed"> |
115 |
<p><a href="http://suika.fam.cx/gate/cvs/*checkout*/markup/html/whatpm/Whatpm/CSS/SelectorsSerializer.pm">See the reference implementation</a> |
116 |
for now.</p> |
117 |
</div> |
118 |
|
119 |
<p><dfn id=newline>Newline</dfn> is <code class=char>U+000A</code> |
120 |
<code class=charname>LINE FEED</code> <span class=ed>or |
121 |
U+000D U+000A or U+000A ??</span>.</p> |
122 |
|
123 |
<!-- TODO: link terms to Selectors --> |
124 |
|
125 |
<ol> |
126 |
<li>Let <var>result</var> an empty string.</li> |
127 |
<li>For each selector (<var>selector</var>) in the group of selectors: |
128 |
<ol> |
129 |
<li>If <var>selector</var> is <em>not</em> the first selector |
130 |
in the group of selectors, then append a <code class=char>U+002C</code> |
131 |
<code class=charname>COMMA</code> followed by a |
132 |
<a href="#newline">newline</a> to <var>result</var>.</li> |
133 |
<li>Append four <code class=char>U+0020</code> |
134 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
135 |
<li>Process each sequence of simple selectors or |
136 |
combinator in <var>selector</var> by following algorithm: |
137 |
<dl class=switch> |
138 |
<dt>If it is a sequence of simle selector (<var>sss</var>)</dt> |
139 |
<dd class=ed>@@</dd> |
140 |
<dt>If it is a combinator (<var>c</var>)</dt> |
141 |
<dd> |
142 |
<ol> |
143 |
<li>Append two <code class=char>U+0020</code> |
144 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
145 |
<li> |
146 |
<dl class=switch> |
147 |
<dt>If <var>c</var> is descendant combinator (white space)</dt> |
148 |
<dd>Append a <code class=char>U+0020</code> |
149 |
<code class=charname>SPACE</code> character to |
150 |
<var>result</var>.</dd> |
151 |
<dt>If <var>c</var> is child combinator |
152 |
(<code class=char>></code>)</dt> |
153 |
<dd>Append a <code class=char>U+003E</code> |
154 |
<code class=charname>GREATER-THAN SIGN</code> character to |
155 |
<var>result</var>.</dd> |
156 |
<dt>If <var>c</var> is adjacent sibling combinator |
157 |
(<code class=char>+</code>)</dt> |
158 |
<dd>Append a <code class=char>U+0020</code> |
159 |
<code class=charname>SPACE</code> character to |
160 |
<var>result</var>.</dd> |
161 |
<dt>If <var>c</var> is general sibling combinator |
162 |
(<code class=char>~</code>)</dt> |
163 |
<dd>Append a <code class=char>U+007E</code> |
164 |
<code class=charname>TILDE</code> character to |
165 |
<var>result</var>.</dd> |
166 |
</dl> |
167 |
</li> |
168 |
<li>Append a <code class=char>U+0020</code> |
169 |
<code class=charname>SPACE</code> character to |
170 |
<var>result</var>.</li> |
171 |
</ol> |
172 |
</dd> |
173 |
</dl> |
174 |
</ol> |
175 |
</li> |
176 |
<li>Then, <var>result</var> is the |
177 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
178 |
representation of the group of selectors.</li> |
179 |
</ol> |
180 |
|
181 |
</div> |
182 |
|
183 |
<div class="section" id="parsing"> |
184 |
<h2>Parsing |
185 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
186 |
Groups of Selectors</h2> |
187 |
|
188 |
<p>Since <a href="#serializing">the serializing algorithm</a> is |
189 |
so designed that it always output a valid |
190 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
191 |
selectors</a>, no special parser for |
192 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
193 |
is necessary. Any conforming |
194 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
195 |
selectors</a> parser <em class=rfc2119>MAY</em> be used |
196 |
to parse <abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
197 |
groups of selectors.</p> |
198 |
</div> |
199 |
|
200 |
<div class="section" id="examples"> |
201 |
<h2>Examples</h2> |
202 |
|
203 |
<p>This section is <em>informative</em>.</p> |
204 |
|
205 |
<div class="ed issue"> |
206 |
<p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>, |
207 |
by choosing <q>Selectors</q> radio button.</a></p> |
208 |
|
209 |
<div class="example figure block"> |
210 |
<div class="caption">...</div> |
211 |
|
212 |
<pre><code>...</code></pre> |
213 |
</div> |
214 |
|
215 |
</div> |
216 |
|
217 |
</div> |
218 |
|
219 |
<div id="references" class="section reference"> |
220 |
<h2>References</h1> |
221 |
|
222 |
<div id="normative-references" class="section normative reference"> |
223 |
<h3>Normative References</h3> |
224 |
|
225 |
<dl> |
226 |
<dt id="ref-KEYWORDS">KEYWORDS</dt> |
227 |
<dd><cite><a href="urn:ietf:rfc:2119">Key words for use in |
228 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
229 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
230 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
231 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, March 1997. |
232 |
This version of the specification is referenced</dd> |
233 |
<dt id=ref-SELECTORS>SELECTORS</dt> |
234 |
<dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>, |
235 |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |
236 |
15 December 2005. Work in progress. |
237 |
<a href="http://www.w3.org/TR/css3-selectors">The latest version</a> |
238 |
of the specification is referenced.</dd> |
239 |
</dl> |
240 |
</div> |
241 |
|
242 |
<div id="informative-references" class="section informative reference"> |
243 |
<h3>Informative References</h3> |
244 |
|
245 |
<dl> |
246 |
<dt id=ref-CSSOM>CSSOM</dt> |
247 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&content-type=text/html;%20charset=utf-8">Cascading |
248 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
249 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
250 |
18 June 2007. Work in progress. The latest Editor's Draft |
251 |
of the specification is available at |
252 |
<code class=uri><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
253 |
</dl> |
254 |
</div> |
255 |
|
256 |
</div> |
257 |
|
258 |
</body> |
259 |
</html> |