-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
498 lines (390 loc) · 19.8 KB
/
Overview.html
File metadata and controls
498 lines (390 loc) · 19.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang=en>
<head><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Namespaces Module</title>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo--></p>
<h1 id=css-namespaces>CSS Namespaces Module</h1>
<h2 class="no-num no-toc" id=longstatus>Editor's Draft 19 February 2008</h2>
<dl>
<dt>This version:</dt>
<!-- <dd><a href="http://www.w3.org/TR/2008/WD-css3-namespace-20080219/">http://www.w3.org/TR/2008/WD-css3-namespace-20080219/</a></dd> -->
<dd><a
href="http://dev.w3.org/csswg/css3-namespace/">http://dev.w3.org/csswg/css3-namespace/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-namespace/">http://www.w3.org/TR/css3-namespace/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2008/WD-css3-namespace-20080215/">http://www.w3.org/TR/2008/WD-css3-namespace-20080215/</a>
<dt>Editors:
<dd><a href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>
<dd><a href="http://annevankesteren.nl/contact">Anne van Kesteren</a>
<dt>Previous Editors:
<dd>Peter Linss, Netscape Communications
<dd>Chris Lilley, W3C
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2008 <a
href="http://www.w3.org/"><acronym title="World Wide Web
Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a
href="http://www.ercim.org/"><acronym title="European Research Consortium
for Informatics and Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>This CSS Namespaces module defines the syntax for using namespaces in
CSS. It defines the <code>@namespace</code> rule for declaring the default
namespace and binding namespaces to namespace prefixes, and it also
defines a syntax that other specifications can adopt for using those
prefixes in namespace-qualified names.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a href="mailto:www-style@w3.org">www-style@w3.org</a> (see
<a href="http://www.w3.org/Mail/Request">instructions</a>) is preferred
for discussion of this specification. When sending e-mail, please put the
text “css3-namespace” in the subject, preferably like this:
“[<!---->css3-namespace<!---->] <em>…summary of
comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent.</p>
<!--end-status-->
<p>This specification is a <strong>Last Call Working Draft</strong>. All
persons are encouraged to review this document and <strong>send comments
to the <a
href="http://lists.w3.org/Archives/Public/www-style/">www-style</a>
mailing list</strong> as described above. The <strong>deadline for
comments</strong> is <strong>7 March 2008</strong>.
<p>A CSS Namespace <a href="http://www.w3.org/Style/CSS/Test/">Test
Suite</a> will be developed during the Candidate Recommendation phase of
this CSS Namespaces specification.
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span>Introduction</a>
<li><a href="#conformance"><span class=secno>2. </span>Conformance</a>
<ul class=toc>
<li><a href="#terminology"><span class=secno>2.1 </span>Terminology</a>
</ul>
<li><a href="#declaration"><span class=secno>3. </span>Declaring
namespaces: the <code>@namespace</code> rule</a>
<ul class=toc>
<li><a href="#syntax"><span class=secno>3.1 </span>Syntax</a>
<li><a href="#scope"><span class=secno>3.2 </span>Scope</a>
<li><a href="#prefixes"><span class=secno>3.3 </span>Declaring
Prefixes</a>
</ul>
<li><a href="#css-qnames"><span class=secno>4. </span>CSS Qualified
Names</a>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#informative-references">Informative
references</a>
</ul>
</ul>
<!--end-toc-->
<div>
<h2 id=intro><span class=secno>1. </span>Introduction</h2>
<p><em>This section is non-normative.</em></p>
<p>This CSS Namespaces module defines syntax for using namespaces in CSS.
It defines the <code>@namespace</code> rule for declaring a default
namespace and for binding namespaces to namespace prefixes. It also
defines a syntax for using those prefixes to represent
namespace-qualified names. It does not define where such names are valid
or what they mean: that depends on their context and is defined by a host
language, such as Selectors (<a href="#SELECT"
rel=biblioentry>[SELECT]<!--{{SELECT}}--></a>), that references the
syntax defined in the CSS Namespaces module.</p>
<p>Note that a CSS client that does not support this module will (if it
properly conforms to <a
href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">CSS's
forward-compatible parsing rules</a>) ignore all @namespace rules, as
well as all style rules that make use of namespace qualified names. The
syntax of delimiting namespace prefixes in CSS was deliberately chosen so
that these CSS clients would ignore the style rules rather than possibly
match them incorrectly.</p>
</div>
<div>
<h2 id=conformance><span class=secno>2. </span>Conformance</h2>
<p>A document or implementation cannot conform to CSS Namespaces alone,
but can claim conformance to CSS Namespaces if it satisfies the
conformance requirements in this specification when implementing CSS or
another host language that normatively references this specification.</p>
<p>Conformance to CSS Namespaces is defined for two classes:</p>
<dl>
<dt><dfn id=style>style sheet</dfn>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
style sheet</a> (or a complete unit of another host language that
normatively references CSS Namespaces).
<dt><dfn id=interpreter>interpreter</dfn>
<dd>Someone or something that interprets the semantics of a style sheet.
(CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
agents</a> fall under this category.)
</dl>
<p>The conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words "MUST",
"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
document are to be interpreted as described in RFC 2119. However, for
readability, these words do not appear in all uppercase letters in this
specification. All of the text of this specification is normative except
sections explicitly marked as non-normative, examples, and notes. <a
href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a></p>
<p>Examples in this specification are introduced with the words "for
example" or are set apart from the normative text with
<code>class="example"</code>, like this:</p>
<div class=example>
<p>This is an example of an informative example.</p>
</div>
<p>Informative notes begin with the word "Note" and are set apart from the
normative text with <code>class="note"</code>, like this:</p>
<p class=note>Note, this is an informative note.</p>
<h3 id=terminology><span class=secno>2.1 </span>Terminology</h3>
<p>Besides terms introduced by this specification, CSS Namespaces uses the
terminology defined in Namespaces in XML 1.0. <a href="#REC-XML-NAMES"
rel=biblioentry>[REC-XML-NAMES]<!--{{!REC-XML-NAMES}}--></a> However, the
syntax defined here is not restricted to representing XML element and
attribute names and may represent other kinds of namespaces as defined by
the host language.</p>
</div>
<div>
<h2 id=declaration><span class=secno>3. </span>Declaring namespaces: the
<code>@namespace</code> rule</h2>
<p>The @namespace <a
href="http://www.w3.org/TR/CSS21/syndata.html#at-rules">at-rule</a>
declares a namespace prefix and associates it with a given namespace name
(a string). This namespace prefix can then be used in namespace-qualified
names such as those described in the Selectors module <a href="#SELECT"
rel=biblioentry>[SELECT]<!--{{SELECT}}--></a> or the Values and Units
module <a href="#CSS3VAL"
rel=biblioentry>[CSS3VAL]<!--{{CSS3VAL}}--></a>.</p>
<div class=example>
<pre>@namespace "http://www.w3.org/1999/xhtml";
<!-- -->@namespace svg "http://www.w3.org/2000/svg";</pre>
<p>The first rule declares a default namespace
<code>http://www.w3.org/1999/xhtml</code> to be applied to names that
have no explicit namespace component.</p>
<p>The second rule declares a namespace prefix <code>svg</code> that is
used to apply the namespace <code>http://www.w3.org/2000/svg</code>
where the <code>svg</code> namespace prefix is used.</p>
</div>
<p id=expanded-name-match>In CSS Namespaces, as in Namespaces in XML 1.0,
the prefix is merely a syntactic construct; it is the <em><dfn
id=expanded-name>expanded name</dfn></em> (the tuple of local name and
namespace name) that is significant. Thus the actual prefixes used in a
CSS style sheet, and whether they are defaulted or not, are independent
of the namespace prefixes used in the markup and whether these are
defaulted or not.</p>
<h3 id=syntax><span class=secno>3.1 </span>Syntax</h3>
<p>The syntax for the @namespace rule is as follows (using the notation
from the <a href="http://www.w3.org/TR/CSS21/grammar.html">Grammar
appendix of CSS 2.1</a> <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>):</p>
<pre><!--
-->namespace
<!-- --> : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
<!-- --> ;
<!-- -->namespace_prefix
<!-- --> : IDENT
<!-- --> ;<!--
--></pre>
<p>with the new token:</p>
<pre>@{N}{A}{M}{E}{S}{P}{A}{C}{E} {return NAMESPACE_SYM;}</pre>
<p>Any @namespace rules must follow all @charset and @import rules and
precede all other non-ignored at-rules and rule sets in a style sheet.
For CSS syntax this adds <code>[ namespace [S|CDO|CDC]* ]*</code>
immediately after <code>[ import [S|CDO|CDC]* ]*</code> in the
<code>stylesheet</code> grammar.</p>
<p>A syntactically invalid <code>@namespace</code> rule (whether malformed
or misplaced) must be <a
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. A CSS
<a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">style
sheet</a> containing an invalid <code>@namespace</code> rule is itself <a
href="http://www.w3.org/TR/CSS21/conform.html#valid-style-sheet">invalid</a>.</p>
<p>A URI string parsed from the <code>URI</code> syntax must be treated as
a literal string: as with the <code>STRING</code> syntax, no URI-specific
normalization is applied.</p>
<h3 id=scope><span class=secno>3.2 </span>Scope</h3>
<p>The namespace prefix is declared only within the style sheet in which
its @namespace rule appears. It is not declared in any style sheets
importing or imported by that style sheet, nor in any other style sheets
applying to the document.</p>
<h3 id=prefixes><span class=secno>3.3 </span>Declaring Prefixes</h3>
<p>A <dfn id=namespace>namespace prefix</dfn>, once declared, represents
the namespace for which it was declared and can be used to indicate the
namespace of a namespace-qualified name.</p>
<p>If in the namespace declaration the namespace prefix is omitted, then
the namespace so declared is the default namespace. The <dfn
id=default>default namespace</dfn> applies to names that have no explicit
namespace prefix. Modules that employ namespace prefixes must define in
which contexts the default namespace applies. For example, following <a
href="#REC-XML-NAMES"
rel=biblioentry>[REC-XML-NAMES]<!--{{!REC-XML-NAMES}}--></a>, in
Selectors <a href="#SELECT" rel=biblioentry>[SELECT]<!--{{SELECT}}--></a>
the default namespace applies to type selectors—but it does not
apply to attribute selectors. There is no default value for the default
namespace: modules that assign unqualified names to the default namespace
must define how those unqualified names are to be interpreted when no
default namespace is declared.</p>
<p>Namespace prefixes are, <a
href="http://www.w3.org/TR/CSS21/syndata.html#counter">like CSS counter
names</a>, case-sensitive.</p>
<p>If a namespace prefix or default namespace is declared more than once
only the last declaration shall be used.</p>
</div>
<div>
<h2 id=css-qnames><span class=secno>4. </span>CSS Qualified Names</h2>
<p>A <dfn id=css-qualified>CSS qualified name</dfn> is a name explicitly
located within (associated with) a namespace. To form a qualified name in
CSS syntax, a namespace prefix that has been declared within scope is
prepended to a local name (such as an element or attribute name),
separated by a "vertical bar" (<code>|</code>, U+007C). The prefix,
representing the namespace for which it has been declared, indicates the
namespace of the local name. The prefix of a qualified name may be
omitted to indicate that the name belongs to no namespace, i.e. that the
namespace name part of the expanded name has no value. Some contexts may
allow the use of an asterisk (<code>*</code>, U+002A) as a wildcard
prefix to indicate a name in any namespace, including no namespace.</p>
<div class=example>
<p>Given the namespace declarations:</p>
<pre>@namespace toto "http://toto.example.org";
<!-- -->@namespace "http://example.com/foo";</pre>
<p>In a context where the default namespace applies</p>
<dl>
<dt><code>toto|A</code>
<dd>represents the name <code>A</code> in the
<code>http://toto.example.org</code> namespace.
<dt><code>|B</code>
<dd>represents the name <code>B</code> that belongs to no namespace.
<dt><code>*|C</code>
<dd>represents the name <code>C</code> in any namespace, including no
namespace.
<dt><code>D</code>
<dd>represents the name <code>D</code> in the
<code>http://example.com/foo</code> namespace.
</dl>
</div>
<p>CSS qualified names can be used in (for example) selectors and property
values as described in other modules. Those modules must define handling
of namespace prefixes that have not been properly declared. Such handling
should treat undeclared namespace prefixes as a parsing error that will
cause the selector or declaration (etc.) to be considered invalid and, in
CSS, <a
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.</p>
<p>In a CSS qualified name, a prefix that is declared to represent the
empty string namespace (<code>""</code>) is interpreted as representing
no namespace.</p>
</div>
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
<p>This draft borrows heavily from earlier drafts on CSS namespace support
by Chris Lilley and by Peter Linss and early (unpublished) drafts on CSS
and XML by Håkon Lie and Bert Bos, and XML Namespaces and CSS by
Bert Bos and Steven Pemberton. Many current and former members of the CSS
Working Group have contributed to this document. Discussions on
www-style@w3.org and in other places have also contributed ideas to this
specification. Special thanks goes to L. David Baron, Karl Dubost, Ian
Hickson, Bjöern Höhrmann, and Lachlan Hunt for their comments.
<h2 class=no-num id=references>References</h2>
<h3 class=no-num id=normative-references>Normative references</h3>
<!--begin-normative-->
<!-- Sorted by label -->
<dl class=bibliography>
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!---->
<dt id=CSS21>[CSS21]
<dd>Bert Bos; et al. <cite>Cascading Style Sheets, level 2 revision
1.</cite> 19 July 2007. W3C Candidate Recommendation. (Work in progress.)
URL: <a
href="http://www.w3.org/TR/2007/CR-CSS21-20070719">http://www.w3.org/TR/2007/CR-CSS21-20070719</a>
</dd>
<!---->
<dt id=REC-XML-NAMES>[REC-XML-NAMES]
<dd>Tim Bray; et al. <cite>Namespaces in XML.</cite> 16 August 2006. W3C
Recommendation. URL: <a
href="http://www.w3.org/TR/2006/REC-xml-names-20060816">http://www.w3.org/TR/2006/REC-xml-names-20060816</a>
</dd>
<!---->
<dt id=RFC2119>[RFC2119]
<dd>S. Bradner. <cite>Key words for use in RFCs to Indicate Requirement
Levels.</cite> Internet RFC 2119. URL: <a
href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
</dd>
<!---->
</dl>
<!--end-normative-->
<h3 class=no-num id=informative-references>Informative references</h3>
<!--begin-informative-->
<!-- Sorted by label -->
<dl class=bibliography>
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!---->
<dt id=CSS3VAL>[CSS3VAL]
<dd>Håkon Wium Lie; Chris Lilley. <cite>CSS3 module: Values and
Units.</cite> 19 September 2006. W3C Working Draft. (Work in progress.)
URL: <a
href="http://www.w3.org/TR/2006/WD-css3-values-20060919">http://www.w3.org/TR/2006/WD-css3-values-20060919</a>
</dd>
<!---->
<dt id=SELECT>[SELECT]
<dd>Daniel Glazman; Tantek Çelik; Ian Hickson (eds).
<cite>Selectors.</cite> 15 December 2005. W3C Working Draft. (Work in
progress.) URL: <a
href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215">http://www.w3.org/TR/2005/WD-css3-selectors-20051215</a>
</dd>
<!---->
</dl>
<!--end-informative-->
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:t
sgml-general-insert-case:lower
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->