Fri, 11 Oct 2013 01:20:50 +0100
[css-style-attr] Parse at-rules in declarations lists, like @page.
(No such at-rule is defined yet, this is only for error handling purpose.)
Working Group resolution:
http://lists.w3.org/Archives/Public/www-style/2013May/0783.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>CSS Style Attributes</title>
6 <link rel=contents href="#contents">
7 <link rel=index href="#index">
8 <link rel="stylesheet" type="text/css" href="../default.css">
9 <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
10 <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
11 <script defer=defer
12 src="http://test.csswg.org/harness/annotate.js#css-style-attr-1_dev"
13 type="text/javascript"></script>
14 </head>
16 <body class="h-entry">
18 <div class="head">
19 <!--logo-->
21 <h1 class="p-name">CSS Style Attributes</h1>
23 <h2 class="no-num no-toc">[LONGSTATUS] <span class="dt-updated"><span class="value-title" title="[CDATE]">[DATE]</span></span></h2>
24 <dl>
25 <dt>This version:</dt>
26 <dd><a class="u-url" href="[VERSION]">[VERSION]</a>
28 <dt>Latest version:
29 <dd><a href="http://www.w3.org/TR/[SHORTNAME]/">http://www.w3.org/TR/[SHORTNAME]/</a>
31 <dt>Editor's draft:
32 <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
33 (<a href="https://dvcs.w3.org/hg/csswg/log/tip/[SHORTNAME]/Overview.src.html">change log</a>)
35 <dt>Previous version:
36 <dd><a href="http://www.w3.org/TR/2013/PR-css-style-attr-20131003/">http://www.w3.org/TR/2013/PR-css-style-attr-20131003/</a>
38 <dt>Feedback:
39 <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-style-attr%5D%20feedback">www-style@w3.org</a>
40 with subject line “<kbd>[[SHORTNAME]] <var>… message topic …</var></kbd>”
41 (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
43 <dt>Editors:
44 <dd class="p-author h-card vcard">
45 <a lang="tr" class="p-name fn u-url url" rel="author"
46 href="http://tantek.com/">Tantek Çelik</a>
47 (<a class="p-org org h-org"
48 href="https://mozilla.org/">Mozilla</a>,
49 and formerly at
50 <a href="http://microsoft.com/">Microsoft Corporation</a>)
51 <<a class="u-email email"
52 href="mailto:tantek@cs.stanford.edu">tantek@cs.stanford.edu</a>>
53 </dd>
54 <dd class="p-author h-card vcard">
55 <a class="p-name fn n u-url url" rel="author"
56 href="http://fantasai.inkedblade.net/contact"><span class="p-given-name given-name">Elika</span>
57 <abbr class="p-additional-name additional-name">J.</abbr>
58 <span class="p-family-name family-name">Etemad</span></a>
59 (<a class="p-org org h-org"
60 href="https://mozilla.org/">Mozilla</a>)
61 </dd>
62 <dt>Previous Editors:
63 <dd class="vcard"><a class="fn url" href="http://www.w3.org/People/Bos/">Bert Bos</a> (<a class="org" href="http://www.w3.org/">W3C</a>), <<a class="email" href="mailto:bert@w3.org">bert@w3.org</a>>
64 </dd>
65 <dd class="vcard"><span class="fn">Marc Attinasi</span> (<span class="org">AOL/Netscape</span>), <<a class="email" href="mailto:attinasi@netscape.com">attinasi@netscape.com</a>>
66 </dd>
67 <dt>Test suite:</dt>
68 <dd>
69 <a href="http://test.csswg.org/suites/css-style-attr/nightly-unstable/">http://test.csswg.org/suites/css-style-attr/nightly-unstable/</a>
70 </dd>
71 </dl>
72 <!--begin-copyright-->
73 <p>[Here will be included the file "../copyright.inc"]</p>
74 <!--end-copyright-->
76 <hr title="Separator for header">
77 </div>
79 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
81 <p><span class="p-summary">
82 Markup languages such as HTML [[HTML401]] and SVG [[SVG11]] provide a style
83 attribute on most elements, to hold inline style information that applies
84 to those elements. This
85 draft describes the syntax and interpretation of the CSS fragment that can
86 be used in such style attributes.
87 </span>
89 <h2 class="no-num no-toc" id="status">Status of this document</h2>
90 <!--status-->
91 <p>For this specification to exit the CR stage, the following conditions
92 shall be met:
94 <ol>
95 <li>
96 <p>There must be at least two interoperable implementations. For the
97 purposes of this criterion, we define the following terms:</p>
99 <dl>
100 <dt>interoperable
102 <dd>
103 <p>passing the respective test case(s) in the <a
104 href="http://www.w3.org/Style/CSS/Test/">CSS test suite</a>, or, if
105 the implementation is not a Web browser, an equivalent test. Every
106 relevant test in the test suite should have an equivalent test created
107 if such a user agent (UA) is to be used to claim interoperability. In
108 addition if such a UA is to be used to claim interoperability, then
109 there must one or more additional UAs which can also pass those
110 equivalent tests in the same way for the purpose of interoperability.
111 The equivalent tests must be made publicly available for the purposes
112 of peer review.</p>
114 <dt>implementation
116 <dd>
117 <p>a user agent which:</p>
119 <ol>
120 <li>implements the specification.
122 <li>is available (i.e. publicly downloadable or available through some
123 other public point of sale mechanism). This is the "show me"
124 requirement.
126 <li>is shipped, or is a "nightly build" (i.e., a development version
127 for the next release), but is not experimental (i.e., a version
128 specifically designed to pass the test suite and not intended for
129 daily usage going forward).
130 </ol>
131 </dl>
133 <li>
134 <p>A minimum of three months of the CR period must elapse. That
135 is, this specification will not exit CR before (DATE OF PUBLICATION PLUS THREE MONTHS). When the
136 specification exits CR, an implementation report will be published. At
137 this point, no such report exists.</p>
138 </ol>
140 <p>A CSS Style Attributes <a href="http://www.w3.org/Style/CSS/Test/">Test
141 Suite</a> will be developed during the Candidate Recommendation phase of
142 this CSS Style Attributes specification.
144 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
145 <!--toc-->
147 <h2 id="intro">Introduction</h2>
149 <p>Some document formats have a <dfn>style attribute</dfn> to permit
150 the author to directly apply style information to specific elements
151 in documents. If a document format defines a style attribute (whether named 'style' or something else) and the
152 attribute accepts CSS as its value, then this specification defines that
153 <dfn>style attribute</dfn>’s syntax and interpretation.
155 <div class="example">
156 <p>The following example shows the use of the <code>style</code> attribute
157 in HTML [[HTML401]]:</p>
158 <pre><p style="<em>color: #090; line-height: 1.2</em>">...</p></pre>
159 </div>
161 <h2 id="conformance">Conformance</h2>
163 <p>A document or implementation cannot conform to CSS Style Attributes alone, but can claim conformance to CSS Style Attributes
164 if it satisfies the conformance requirements in this specification when
165 implementing CSS together with style attribute handling as defined in a
166 document language that has one or more CSS style attributes.</p>
168 <p>Conformance to CSS Style Attributes is defined for two
169 classes:
170 <dl>
171 <dt><dfn>document</dfn></dt>
172 <dd>A document represented in a document language that defines a style
173 attribute for one or more of its elements.
174 <dt><dfn>interpreter</dfn></dt>
175 <dd>Someone or something that interprets the semantics of a document and
176 its associated style information.
177 (Most CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
178 agents</a> fall under this category.)</dd>
179 </dl>
181 <p>The conformance requirements are expressed with a combination of
182 descriptive assertions and RFC 2119 terminology. The key words "MUST",
183 "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
184 "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
185 document are to be interpreted as described in RFC 2119.
186 However, for readability, these words do not appear in all uppercase
187 letters in this specification. All of the text of this specification is
188 normative except sections explicitly marked as non-normative, examples,
189 and notes. [[!RFC2119]]</p>
191 <p>Examples in this specification are introduced with the words "for example"
192 or are set apart from the normative text with <code>class="example"</code>,
193 like this:
195 <div class="example">
196 <p>This is an example of an informative example.</p>
197 </div>
199 <p>Informative notes begin with the word "Note" and are set apart from the
200 normative text with <code>class="note"</code>, like this:
202 <p class="note">Note, this is an informative note.</p>
204 <h2 id="syntax">Syntax and Parsing</h2>
206 <p>The value of the style attribute must match the syntax of the contents of
207 a CSS <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
208 block</a> (excluding the delimiting braces), whose formal grammar is given
209 below in the terms and conventions of the
210 <a href="http://www.w3.org/TR/CSS21/syndata.html#syntax">CSS core grammar</a>:
212 <pre>
213 declaration-list
214 : S* declaration-list-next
215 ;
217 declaration-list-next
218 : declaration [ ';' S* declaration-list-next ]?
219 | at-rule declaration-list-next
220 | /* empty */
221 ;
222 </pre>
224 <p class="note">Note that following the CSS2.1 convention, comment tokens
225 are not shown in the rule above.
227 <p>The interpreter must parse the style attribute's value using the
228 same forward-compatible parsing rules that apply to parsing declaration block
229 contents in a normal CSS style sheet (see
230 <a href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
231 specification</a> [[!CSS21]]),
232 with the following addition: when the UA expects the start of a declaration or at-rule
233 (i.e., an IDENT token or an ATKEYWORD token) but finds an unexpected token instead,
234 that token is considered to be the first token of a malformed declaration.
235 I.e., the rule for malformed declarations, rather than malformed statements,
236 is used to determine which tokens to ignore in that case.
238 <p class="note">Note that because there is no open brace delimiting the
239 declaration list in the CSS style attribute syntax, a close brace
240 (<code>}</code>) in the style attribute's value does not terminate the
241 style data: it is merely an invalid token.</p>
243 <div class="note">
244 <p>Although the grammar allows it,
245 no at-rule valid in style attributes is define at the moment.
246 The forward-compatible parsing rules are such that a declaration following an at-rule
247 is not ignored:
248 <pre><span style="@unsupported { splines: reticulating } color: green"></pre>
249 </div>
251 <h2 id="interpret">Cascading and Interpretation</h2>
253 <p>The declarations in a style attribute apply to the element to which
254 the attribute belongs. In the cascade, these declarations are considered
255 to have author origin and a specificity higher than any selector.
256 CSS2.1 <a href="http://www.w3.org/TR/CSS21/cascade.html#specificity">defines</a>
257 how style sheets and style attributes are cascaded together. [[!CSS21]]
258 Relative URLs in the style data must be resolved relative to the style attribute's element (or to the document if per-element resolution is not
259 defined) when the attribute's value is parsed<!-- so dynamic changes to
260 the base URL don't affect the CSS ~Hixie -->.
262 <p>Aside from the differences in cascading, the declarations in a style
263 attribute must be interpreted exactly as if they were given in a CSS
264 style rule that applies to the element.
266 <p>The CSS Working Group strongly recommends that document languages do
267 not allow multiple CSS style attributes on a single element. If a document
268 language allows multiple CSS style attributes, each must be parsed
269 independently and treated as a separate style rule, the ordering of which
270 should be defined by the document language, else is undefined.
272 <h2 id="changes">Changes</h2>
274 Changes since the <a href="http://www.w3.org/TR/2013/PR-css-style-attr-20131003/">2013-10-03 Proposed Recommendation</a> are:
276 <ul>
277 <li>Parse at-rules in declaration lists to allow future extension.
278 </ul>
280 <h2 id="ack">Acknowledgments</h2>
282 <p>Thanks to feedback from <span class="vcard"><span class="fn">Daniel Glazman</span></span>, <span class="vcard"><span class="fn">Ian Hickson</span></span>, <span class="vcard"><span class="fn n"><span class="given-name">Eric</span> <abbr class="additional-name">A.</abbr> <span class="family-name">Meyer</span></span></span>,
283 <span class="vcard"><span class="fn">Björn Höhrmann</span></span>.
284 </p>
286 <h2 id="references">References
288 <h3 class="no-num" id="normative-references">Normative references</h3>
290 <!--begin-normative-->
291 <p>[Here will be inserted the file "normative.inc"]</p>
292 <!--end-normative-->
294 <h3 class="no-num" id="informative-references">Informative references</h3>
296 <!--begin-informative-->
297 <p>[Here will be inserted the file "informative.inc"]</p>
298 <!--end-informative-->
300 </body>
301 </html>
302 <!-- Keep this comment at the end of the file
303 Local variables:
304 mode: sgml
305 sgml-declaration:"~/SGML/HTML4.decl"
306 sgml-default-doctype-name:"html"
307 sgml-minimize-attributes:t
308 sgml-nofill-elements:("pre" "style" "br")
309 End:
310 -->