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 <time datetime=2007-10-01>1 October 2007</time></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 |
<dt>Version History</dt> |
27 |
<dd><code class=URI><<a href="http://suika.fam.cx/gate/cvs/markup/selectors/ssft/ssft.en.html">http://suika.fam.cx/gate/cvs/markup/selectors/ssft/ssft.en.html</a>></code></dd> |
28 |
</dl> |
29 |
<dl class="authors" id="author"> |
30 |
<dt>Author</dt> |
31 |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
32 |
lang=ja>Wakaba</a> |
33 |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
34 |
>w@suika.fam.cx</a>></code></dd> |
35 |
</dl> |
36 |
|
37 |
<p class="copyright" lang="en">© <time>2007</time> <a |
38 |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
39 |
Permission is granted to copy, distribute and/or modify this document |
40 |
under the terms of the <a rel="license" |
41 |
href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>, |
42 |
Version 1.2 |
43 |
or any later version published by the <a |
44 |
href="http://www.fsf.org/">Free Software Foundation</a>; |
45 |
with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover |
46 |
Texts. A copy of the license is |
47 |
available at <code class="URI"><<a |
48 |
href="http://www.gnu.org/copyleft/fdl.html" |
49 |
rel="license">http://www.gnu.org/copyleft/fdl.html</a>></code>.</p> |
50 |
</div> |
51 |
|
52 |
<div id="abstract" class="section"> |
53 |
<h2>Abstract</h2> |
54 |
|
55 |
<div class="ed issue">...</div> |
56 |
|
57 |
</div> |
58 |
|
59 |
<div id="status" class="section"> |
60 |
<h2>Status of This Document</h2> |
61 |
|
62 |
<p class=section-info><em>This section describes the status of this document |
63 |
at the time of its publication. Other documents |
64 |
might supersede this document.</em></p> |
65 |
|
66 |
<p>This document is a working draft, produced as part |
67 |
of the <a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a> |
68 |
project. It might be updated, replaced, or obsoleted by |
69 |
other documents at any time. It is inappropriate to |
70 |
cite this document as other than <q>work in progress</q>.</p> |
71 |
|
72 |
<p>Comments on this document are welcome and |
73 |
may be sent to the <a href="#author">author</a>.</p> |
74 |
|
75 |
<p>Translations of thie document might be available. |
76 |
The English version of the document is the only |
77 |
normative version.</p> |
78 |
</div> |
79 |
|
80 |
<div id="introduction" class="section"> |
81 |
<h2>Introduction</h2> |
82 |
|
83 |
<p class=section-info>This section is <em>non-normative</em>.</p> |
84 |
|
85 |
<p>Selectors |
86 |
<cite class="bibref normative">[<a href="#ref-SELECTORS">SELECTORS</a>]</cite> |
87 |
are patterns that match against elements |
88 |
in a tree structure and are used in Web technologies, including |
89 |
<a href="http://www.w3.org/TR/CSS21"><abbr title="Cascading Style Sheets">CSS</abbr></a> |
90 |
<cite class="bibref informative">[<a href="#ref-CSS">CSS</a>]</cite>, |
91 |
<a href="http://whatwg.org/html5"><abbr title="Hypertext Markup Language">HTML</abbr>5</a> |
92 |
<cite class="bibref informative">[<a href="#ref-HTML5">HTML5</a>]</cite>, |
93 |
<a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr title="XML Binding Language">XBL</abbr>2</a> |
94 |
<cite class="bibref informative">[<a href="#ref-XBL2">XBL2</a>]</cite>, and |
95 |
<a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8">Selectors |
96 |
<abbr>API</abbr></a> |
97 |
<cite class="bibref informative">[<a href="#ref-SAPI">SAPI</a>]</cite>.</p> |
98 |
|
99 |
<div class="issue ed">...</div> |
100 |
|
101 |
<p><a href="http://dev.w3.org/cvsweb/csswg/cssom/Overview.html">The |
102 |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
103 |
specification</a> |
104 |
<cite class="bibref informative">[<a href="#ref-CSSOM">CSSOM</a>]</cite> |
105 |
is trying to define an algorithm to |
106 |
<a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&content-type=text/html;%20charset=utf-8#serializing0">serialize |
107 |
a group of selectors</a> for the purpose of <code>selectorText</code> |
108 |
attribute. However, the algorithm is incomplete |
109 |
<time datetime=2007-09-25>at the time of the writing</time>. |
110 |
Note that current Web browser implementations |
111 |
of the <code>selectorText</code> attribute are consistently broken |
112 |
in not escaping unsafe identifiers.</p> |
113 |
|
114 |
</div> |
115 |
|
116 |
<div class="section" id="terminology"> |
117 |
<h2>Terminology</h2> |
118 |
|
119 |
<p>The key words <q><em class="rfc2119">MUST</em></q>, |
120 |
<q><em class="rfc2119">MUST NOT</em></q>, |
121 |
<q><em class="rfc2119">SHOULD</em></q>, |
122 |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
123 |
<q><em class=rfc2119>MAY</em></q> in this |
124 |
document are to be interpreted as described in |
125 |
<a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr> |
126 |
2119</a> |
127 |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
128 |
|
129 |
<!-- Strictly speaking the paragraph below is not part of terminology. --> |
130 |
<p>All examples and notes in this specification are non-normative, |
131 |
as are all sections explicitly marked non-normative. Everything |
132 |
else in this specification is normative.</p> |
133 |
</div> |
134 |
|
135 |
<div class="section" id="serializing"> |
136 |
<h2>Serializing Groups of Selectors</h2> |
137 |
|
138 |
<div class="issue ed"> |
139 |
<p><a href="http://suika.fam.cx/gate/cvs/*checkout*/markup/html/whatpm/Whatpm/CSS/SelectorsSerializer.pm">See the reference implementation</a> |
140 |
for now.</p> |
141 |
</div> |
142 |
|
143 |
<p><dfn id=newline>Newline</dfn> is <code class=char>U+000A</code> |
144 |
<code class=charname>LINE FEED</code> <span class=ed>or |
145 |
U+000D U+000A or U+000A ??</span>.</p> |
146 |
|
147 |
<!-- TODO: link terms to Selectors --> |
148 |
|
149 |
<ol> |
150 |
<li>Let <var>result</var> an empty string.</li> |
151 |
<li>For each selector (<var>selector</var>) in the group of selectors: |
152 |
<ol> |
153 |
<li>If <var>selector</var> is <em>not</em> the first selector |
154 |
in the group of selectors, then append a <code class=char>U+002C</code> |
155 |
<code class=charname>COMMA</code> followed by a |
156 |
<a href="#newline">newline</a> to <var>result</var>.</li> |
157 |
<li>Append four <code class=char>U+0020</code> |
158 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
159 |
<li>Process each sequence of simple selectors or |
160 |
combinator in <var>selector</var> by following algorithm: |
161 |
<dl class=switch> |
162 |
<dt>If it is a sequence of simle selector (<var>sss</var>)</dt> |
163 |
<dd class=ed>@@</dd> |
164 |
<dt>If it is a combinator (<var>c</var>)</dt> |
165 |
<dd> |
166 |
<ol> |
167 |
<li>Append two <code class=char>U+0020</code> |
168 |
<code class=charname>SPACE</code> characters to <var>result</var>.</li> |
169 |
<li> |
170 |
<dl class=switch> |
171 |
<dt>If <var>c</var> is descendant combinator (white space)</dt> |
172 |
<dd>Append a <code class=char>U+0020</code> |
173 |
<code class=charname>SPACE</code> character to |
174 |
<var>result</var>.</dd> |
175 |
<dt>If <var>c</var> is child combinator |
176 |
(<code class=char>></code>)</dt> |
177 |
<dd>Append a <code class=char>U+003E</code> |
178 |
<code class=charname>GREATER-THAN SIGN</code> character to |
179 |
<var>result</var>.</dd> |
180 |
<dt>If <var>c</var> is adjacent sibling combinator |
181 |
(<code class=char>+</code>)</dt> |
182 |
<dd>Append a <code class=char>U+002B</code> |
183 |
<code class=charname>PLUS SIGN</code> character to |
184 |
<var>result</var>.</dd> |
185 |
<dt>If <var>c</var> is general sibling combinator |
186 |
(<code class=char>~</code>)</dt> |
187 |
<dd>Append a <code class=char>U+007E</code> |
188 |
<code class=charname>TILDE</code> character to |
189 |
<var>result</var>.</dd> |
190 |
</dl> |
191 |
</li> |
192 |
<li>Append a <code class=char>U+0020</code> |
193 |
<code class=charname>SPACE</code> character to |
194 |
<var>result</var>.</li> |
195 |
</ol> |
196 |
</dd> |
197 |
</dl> |
198 |
</ol> |
199 |
</li> |
200 |
<li>Then, <var>result</var> is the |
201 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
202 |
representation of the group of selectors.</li> |
203 |
</ol> |
204 |
|
205 |
</div> |
206 |
|
207 |
<div class="section" id="parsing"> |
208 |
<h2>Parsing |
209 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
210 |
Groups of Selectors</h2> |
211 |
|
212 |
<p>Since <a href="#serializing">the serializing algorithm</a> is |
213 |
so designed that it always output a valid |
214 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
215 |
selectors</a>, no special parser for |
216 |
<abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
217 |
is necessary. Any conforming |
218 |
<a href="http://www.w3.org/TR/css3-selectors/#grouping">group of |
219 |
selectors</a> parser <em class=rfc2119>MAY</em> be used |
220 |
to parse <abbr title="Selectors Serialization Format for Testing">SFFT</abbr> |
221 |
groups of selectors.</p> |
222 |
</div> |
223 |
|
224 |
<div class="section" id="examples"> |
225 |
<h2>Examples</h2> |
226 |
|
227 |
<p class=section-info>This section is <em>non-normative</em>.</p> |
228 |
|
229 |
<div class="ed issue"> |
230 |
<p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>, |
231 |
by choosing <q>Selectors</q> radio button.</a></p> |
232 |
|
233 |
<div class="example figure block"> |
234 |
<div class="caption">...</div> |
235 |
|
236 |
<pre><code>...</code></pre> |
237 |
</div> |
238 |
|
239 |
</div> |
240 |
|
241 |
</div> |
242 |
|
243 |
<div id="references" class="section reference"> |
244 |
<h2>References</h1> |
245 |
|
246 |
<div id="normative-references" class="section normative reference"> |
247 |
<h3>Normative References</h3> |
248 |
|
249 |
<dl> |
250 |
<dt id="ref-KEYWORDS">KEYWORDS</dt> |
251 |
<dd><cite><a href="urn:ietf:rfc:2119">Key words for use in |
252 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
253 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
254 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
255 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
256 |
<time datetime=1997-03>March 1997</time>. |
257 |
This version of the specification is referenced</dd> |
258 |
<dt id=ref-SELECTORS>SELECTORS</dt> |
259 |
<dd><a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215"><cite>Selectors</cite></a>, |
260 |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |
261 |
<time datetime=2005-12-15>15 December 2005</time>. Work in progress. |
262 |
<a href="http://www.w3.org/TR/css3-selectors">The latest version</a> |
263 |
of the specification is referenced.</dd> |
264 |
</dl> |
265 |
</div> |
266 |
|
267 |
<div id="informative-references" class="section informative reference"> |
268 |
<h3>Non-normative References</h3> |
269 |
|
270 |
<dl> |
271 |
<dt id=ref-CSS>CSS</dt> |
272 |
<dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading |
273 |
Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1) |
274 |
Specification</a></cite>, |
275 |
<abbr title="World Wide Web Consortium">W3C</abbr> Candidate |
276 |
Recommendation, <time datetime=2007-07-19>19 July 2007</time>. |
277 |
Work in progress. The latest version of the specification is |
278 |
available at |
279 |
<code class=URI><<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd> |
280 |
<dt id=ref-CSSOM>CSSOM</dt> |
281 |
<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 |
282 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
283 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
284 |
<time datetime=2007-06-18>18 June 2007</time>. Work in progress. |
285 |
The latest Editor's Draft of the specification is available at |
286 |
<code class=URI><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
287 |
<dt id=ref-HTML5>HTML5</dt> |
288 |
<dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>, |
289 |
<abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr> |
290 |
Working Draft. Work in progress.</dd> |
291 |
<dt id=ref-SAPI>SAPI</dt> |
292 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8">Selectors <abbr>API</abbr></a></cite>, |
293 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
294 |
<time datetime=2007-08-29>29 August 2007</time>. Work in progress. |
295 |
The latest Editor's Draft of the specification is available at |
296 |
<code class=URI><<a href="http://dev.w3.org/2006/webapi/selectors-api/Overview.html">http://dev.w3.org/2006/webapi/selectors-api/Overview.html</a>></code>. |
297 |
The latest published version of the specification is available at |
298 |
<code class=URI><<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd> |
299 |
<dt id=XBL2>XBL2</dt> |
300 |
<dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr> |
301 |
2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>. |
302 |
Work in progress. The latest |
303 |
<abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished |
304 |
version of the specification is available at |
305 |
<code class=URI><<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd> |
306 |
</dl> |
307 |
</div> |
308 |
|
309 |
</div> |
310 |
|
311 |
</body> |
312 |
</html> |