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 25 September 2007</h2> |
<h2>Working Draft <time datetime=2007-10-02>2 October 2007</time></h2> |
14 |
|
|
15 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
<dt>This Version</dt> |
23 |
<dt>Latest Working Draft</dt> |
<dt>Latest Working Draft</dt> |
24 |
--> |
--> |
25 |
<!-- <dt>Previous Version</dt> --> |
<!-- <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> |
</dl> |
29 |
<dl class="authors" id="author"> |
<dl class="authors" id="author"> |
30 |
<dt>Author</dt> |
<dt>Author</dt> |
34 |
>w@suika.fam.cx</a>></code></dd> |
>w@suika.fam.cx</a>></code></dd> |
35 |
</dl> |
</dl> |
36 |
|
|
37 |
<p class="copyright" lang="en">© 2007 <a |
<p class="copyright" lang="en">© <time>2007</time> <a |
38 |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
39 |
Permission is granted to copy, distribute and/or modify this document |
Permission is granted to copy, distribute and/or modify this document |
40 |
under the terms of the <a rel="license" |
under the terms of the <a rel="license" |
59 |
<div id="status" class="section"> |
<div id="status" class="section"> |
60 |
<h2>Status of This Document</h2> |
<h2>Status of This Document</h2> |
61 |
|
|
62 |
<p><em>This section describes the status of this document |
<p class=section-info><em>This section describes the status of this document |
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. |
<p>This document is a working draft, produced as part |
67 |
It might be updated, replaced, or obsoleted by |
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 |
other documents at any time. It is inappropriate to |
70 |
cite this document as other than <q>work in progress</q>.</p> |
cite this document as other than <q>work in progress</q>.</p> |
71 |
|
|
80 |
<div id="introduction" class="section"> |
<div id="introduction" class="section"> |
81 |
<h2>Introduction</h2> |
<h2>Introduction</h2> |
82 |
|
|
83 |
<p>This section is <em>informative</em>.</p> |
<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> |
<div class="issue ed">...</div> |
100 |
|
|
101 |
<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 |
102 |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
<abbr title="Cascading Style Sheets Object Model">CSSOM</abbr> |
103 |
specification</a> |
specification</a> |
104 |
<cite class="bibref informative">[<a href="#bib-CSSOM">CSSOM</a>]</cite> |
<cite class="bibref informative">[<a href="#ref-CSSOM">CSSOM</a>]</cite> |
105 |
is trying to define an algorithm to |
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 |
<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> |
a group of selectors</a> for the purpose of <code>selectorText</code> |
108 |
attribute. However, the algorithm is incomplete |
attribute. However, the algorithm is incomplete |
109 |
at the time of the writing. Note that current Web browser implementations |
<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 |
of the <code>selectorText</code> attribute are consistently broken |
112 |
in not escaping unsafe identifiers.</p> |
in not escaping unsafe identifiers.</p> |
113 |
|
|
122 |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
123 |
<q><em class=rfc2119>MAY</em></q> in this |
<q><em class=rfc2119>MAY</em></q> in this |
124 |
document are to be interpreted as described in |
document are to be interpreted as described in |
125 |
<abbr title="Request for Comments">RFC</abbr> 2119 |
<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> |
<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> |
</div> |
134 |
|
|
135 |
<div class="section" id="serializing"> |
<div class="section" id="serializing"> |
146 |
|
|
147 |
<!-- TODO: link terms to Selectors --> |
<!-- TODO: link terms to Selectors --> |
148 |
|
|
149 |
|
<p>To <dfn id=algorithm-serialize-a-group-of-selectors>serialize a group of |
150 |
|
selectors</dfn> (<dfn id=var-gs><var>gs</var></dfn>):</p> |
151 |
<ol> |
<ol> |
152 |
<li>Let <var>result</var> an empty string.</li> |
<li>Let <dfn id=var-result><var>result</var></dfn> an empty string.</li> |
153 |
<li>For each selector (<var>selector</var>) in the group of selectors: |
<li>For each selector (<dfn id=var-selector><var>selector</var></dfn>) in |
154 |
|
<var>gs</var>: |
155 |
<ol> |
<ol> |
156 |
<li>If <var>selector</var> is <em>not</em> the first selector |
<li>If <var>selector</var> is <em>not</em> the first selector |
157 |
in the group of selectors, then append a <code class=char>U+002C</code> |
in the group of selectors, then append a <code class=char>U+002C</code> |
162 |
<li>Process each sequence of simple selectors or |
<li>Process each sequence of simple selectors or |
163 |
combinator in <var>selector</var> by following algorithm: |
combinator in <var>selector</var> by following algorithm: |
164 |
<dl class=switch> |
<dl class=switch> |
165 |
<dt>If it is a sequence of simle selector (<var>sss</var>)</dt> |
<dt>If it is a sequence of simle selector |
166 |
|
(<dfn id=var-sss><var>sss</var></dfn>)</dt> |
167 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
168 |
<dt>If it is a combinator (<var>c</var>)</dt> |
<dt>If it is a combinator (<dfn id=var-c><var>c</var></dfn>)</dt> |
169 |
<dd> |
<dd> |
170 |
<ol> |
<ol> |
171 |
<li>Append two <code class=char>U+0020</code> |
<li>Append two <code class=char>U+0020</code> |
183 |
<var>result</var>.</dd> |
<var>result</var>.</dd> |
184 |
<dt>If <var>c</var> is adjacent sibling combinator |
<dt>If <var>c</var> is adjacent sibling combinator |
185 |
(<code class=char>+</code>)</dt> |
(<code class=char>+</code>)</dt> |
186 |
<dd>Append a <code class=char>U+0020</code> |
<dd>Append a <code class=char>U+002B</code> |
187 |
<code class=charname>SPACE</code> character to |
<code class=charname>PLUS SIGN</code> character to |
188 |
<var>result</var>.</dd> |
<var>result</var>.</dd> |
189 |
<dt>If <var>c</var> is general sibling combinator |
<dt>If <var>c</var> is general sibling combinator |
190 |
(<code class=char>~</code>)</dt> |
(<code class=char>~</code>)</dt> |
206 |
representation of the group of selectors.</li> |
representation of the group of selectors.</li> |
207 |
</ol> |
</ol> |
208 |
|
|
209 |
|
<p>To <dfn id=algorithm-serialize-a-simple-selector>serialize a simple |
210 |
|
selector</dfn> (<dfn><var id=var-ss>ss</var></dfn>):</p> |
211 |
|
<dl class=switch> |
212 |
|
<dt>If <var>ss</var> is a type or universal selector</dt> |
213 |
|
<dd><dl class=switch> |
214 |
|
<dt>If a namespace URI is specified (via namespace prefix, or |
215 |
|
by omitting namespace prefix where a default namespace is specified)</dt> |
216 |
|
<dd class="ed">@@</dd> |
217 |
|
<dt>If the null namespace is specified (by zero$B!>(Blength namespace |
218 |
|
prefix)</dt> |
219 |
|
<dd>Return a <code class=char>U+007C</code> <code class=charname>VERTICAL |
220 |
|
BAR</code> character, followed by either local name (if <var>ss</var> |
221 |
|
is a type selector) or a <code class=char>U+002A</code> |
222 |
|
<code class=charname>ASTERISK</code> character (if <var>ss</var> |
223 |
|
is a universal selector).</dd> |
224 |
|
<dt>If no namespace is specified (by namespace prefix <code>*</code>, |
225 |
|
or by omitting namespace prefix where no default namespace is specified)</dt> |
226 |
|
<dd>Return a <code class=char>U+002A</code> |
227 |
|
<code class=charname>ASTERISK</code> character, followed by a |
228 |
|
<code class=char>U+007C</code> <code class=charname>VERTICAL BAR</code> |
229 |
|
character, followed by either local name (if <var>ss</var> |
230 |
|
is a type selector) or a <code class=char>U+002A</code> |
231 |
|
<code class=charname>ASTERISK</code> character (if <var>ss</var> |
232 |
|
is a universal selector).</dd> |
233 |
|
</dl></dd> |
234 |
|
<dt class=ed>@@</dt> |
235 |
|
</dl> |
236 |
|
|
237 |
</div> |
</div> |
238 |
|
|
239 |
<div class="section" id="parsing"> |
<div class="section" id="parsing"> |
256 |
<div class="section" id="examples"> |
<div class="section" id="examples"> |
257 |
<h2>Examples</h2> |
<h2>Examples</h2> |
258 |
|
|
259 |
<p>This section is <em>informative</em>.</p> |
<p class=section-info>This section is <em>non-normative</em>.</p> |
260 |
|
|
261 |
<div class="ed issue"> |
<div class="ed issue"> |
262 |
<p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>, |
<p><a href="http://suika.fam.cx/gate/2007/css/parser-interface">Try demo</a>, |
284 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
285 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
286 |
<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> |
287 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, March 1997. |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
288 |
|
<time datetime=1997-03>March 1997</time>. |
289 |
This version of the specification is referenced</dd> |
This version of the specification is referenced</dd> |
290 |
<dt id=ref-SELECTORS>SELECTORS</dt> |
<dt id=ref-SELECTORS>SELECTORS</dt> |
291 |
<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>, |
292 |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |
<abbr title="World Wide Web Consortium">W3C</abbr> Working Draft, |
293 |
15 December 2005. Work in progress. |
<time datetime=2005-12-15>15 December 2005</time>. Work in progress. |
294 |
<a href="http://www.w3.org/TR/css3-selectors">The latest version</a> |
<a href="http://www.w3.org/TR/css3-selectors">The latest version</a> |
295 |
of the specification is referenced.</dd> |
of the specification is referenced.</dd> |
296 |
</dl> |
</dl> |
297 |
</div> |
</div> |
298 |
|
|
299 |
<div id="informative-references" class="section informative reference"> |
<div id="informative-references" class="section informative reference"> |
300 |
<h3>Informative References</h3> |
<h3>Non-normative References</h3> |
301 |
|
|
302 |
<dl> |
<dl> |
303 |
|
<dt id=ref-CSS>CSS</dt> |
304 |
|
<dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading |
305 |
|
Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1) |
306 |
|
Specification</a></cite>, |
307 |
|
<abbr title="World Wide Web Consortium">W3C</abbr> Candidate |
308 |
|
Recommendation, <time datetime=2007-07-19>19 July 2007</time>. |
309 |
|
Work in progress. The latest version of the specification is |
310 |
|
available at |
311 |
|
<code class=URI><<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd> |
312 |
<dt id=ref-CSSOM>CSSOM</dt> |
<dt id=ref-CSSOM>CSSOM</dt> |
313 |
<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 |
<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 |
314 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
315 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
316 |
18 June 2007. Work in progress. The latest Editor's Draft |
<time datetime=2007-06-18>18 June 2007</time>. Work in progress. |
317 |
of the specification is available at |
The latest Editor's Draft of the specification is available at |
318 |
<code class=uri><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
<code class=URI><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
319 |
|
<dt id=ref-HTML5>HTML5</dt> |
320 |
|
<dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>, |
321 |
|
<abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr> |
322 |
|
Working Draft. Work in progress.</dd> |
323 |
|
<dt id=ref-SAPI>SAPI</dt> |
324 |
|
<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>, |
325 |
|
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
326 |
|
<time datetime=2007-08-29>29 August 2007</time>. Work in progress. |
327 |
|
The latest Editor's Draft of the specification is available at |
328 |
|
<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>. |
329 |
|
The latest published version of the specification is available at |
330 |
|
<code class=URI><<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd> |
331 |
|
<dt id=XBL2>XBL2</dt> |
332 |
|
<dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr> |
333 |
|
2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>. |
334 |
|
Work in progress. The latest |
335 |
|
<abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished |
336 |
|
version of the specification is available at |
337 |
|
<code class=URI><<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd> |
338 |
</dl> |
</dl> |
339 |
</div> |
</div> |
340 |
|
|