Skip to content

Commit 9aa4114

Browse files
committed
Upgrade wording throughout in response to hixie's comments about providing
better hooks for HTML5 and more normative wording. <Hixie> fantasai: how should HTML5 refer to http://dev.w3.org/csswg/css-style-attr/ ? <Hixie> there doesn't seem to be a "hook" defined that I can use <Hixie> e.g. i'd like to say "the style attribute is a CSS Styling Attribute. [CSSSTYLE]" or something <Hixie> where "CSS Styling Attribute" would be some term of art defined in that draft <Hixie> it also seems to be lacking in normative conformance criteria <Hixie> for example, it doesn't seem to include the equivalent of this requirement in html5: <Hixie> "In user agents that support CSS, the attribute's value must be parsed when the attribute is added or has its value changed, with its value treated as the body (the part inside the curly brackets) of a declaration block in a rule whose selector matches just the element on which the attribute is set. All URLs in the value must be resolved relative to the element when the attribute is parsed." <Hixie> (the latter bit is required to handle changing base URIs, e.g.) (will handle the last line in the next commit)
1 parent e9438bc commit 9aa4114

2 files changed

Lines changed: 153 additions & 137 deletions

File tree

css-style-attr/Overview.html

Lines changed: 84 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html lang=en>
44
<head><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
55

6-
<title>CSS Style Attribute Syntax Level 1</title>
6+
<title>CSS Styling Attribute Syntax Level 1</title>
77
<link href="../default.css" rel=stylesheet type="text/css">
88
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel=stylesheet
99
type="text/css">
@@ -13,14 +13,13 @@
1313
<p><a href="http://www.w3.org/"><img alt=W3C height=48
1414
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
1515

16-
<h1>CSS Style Attribute Syntax Level 1</h1>
16+
<h1>CSS Styling Attribute Syntax Level 1</h1>
1717

18-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 12 December
19-
2009</h2>
18+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 7 January 2010</h2>
2019

2120
<dl>
2221
<dt>This version:</dt>
23-
<!-- <dd><dd><a href="http://www.w3.org/TR/2009/WD-css-style-attr-20091212/">http://www.w3.org/TR/2009/WD-css-style-attr-20091212/</a></dd> -->
22+
<!-- <dd><dd><a href="http://www.w3.org/TR/2010/WD-css-style-attr-20100107/">http://www.w3.org/TR/2010/WD-css-style-attr-20100107/</a></dd> -->
2423

2524
<dd><a
2625
href="http://dev.w3.org/csswg/css-style-attr/">http://dev.w3.org/csswg/css-style-attr/</a>
@@ -59,7 +58,7 @@ <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 12 December
5958
<!--begin-copyright-->
6059
<p class=copyright><a
6160
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
62-
rel=license>Copyright</a> &copy; 2009 <a
61+
rel=license>Copyright</a> &copy; 2010 <a
6362
href="http://www.w3.org/"><acronym title="World Wide Web
6463
Consortium">W3C</acronym></a><sup>&reg;</sup> (<a
6564
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
@@ -79,10 +78,10 @@ <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 12 December
7978

8079
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
8180

82-
<p>Markup languages such as HTML and SVG provide a "style" attribute on
81+
<p>Markup languages such as HTML and SVG provide a styling attribute on
8382
most elements, to hold a fragment of a style sheet that applies to those
8483
elements. One of the possible style sheet languages is CSS. This draft
85-
describes the syntax of the CSS fragment that can be used in the "style"
84+
describes the syntax of the CSS fragment that can be used in the styling
8685
attribute.
8786

8887
<h2 class="no-num no-toc" id=status>Status of this document</h2>
@@ -126,14 +125,14 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
126125
<ul class=toc>
127126
<li><a href="#intro"><span class=secno>1. </span>Introduction</a>
128127

129-
<li><a href="#syntax"><span class=secno>2. </span>Syntax</a>
128+
<li><a href="#conformance"><span class=secno>2. </span>Conformance</a>
130129

131-
<li><a href="#grammar"><span class=secno>3. </span>Grammar</a>
130+
<li><a href="#syntax"><span class=secno>3. </span>Syntax and Parsing</a>
132131

133-
<li><a href="#interpret"><span class=secno>4. </span>Cascading and
134-
Interpretation</a>
132+
<li><a href="#grammar"><span class=secno>4. </span>Grammar</a>
135133

136-
<li><a href="#conformance"><span class=secno>5. </span>Conformance</a>
134+
<li><a href="#interpret"><span class=secno>5. </span>Cascading and
135+
Interpretation</a>
137136

138137
<li><a href="#ack"><span class=secno>6. </span>Acknowledgments</a>
139138

@@ -150,11 +149,12 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
150149

151150
<h2 id=intro><span class=secno>1. </span>Introduction</h2>
152151

153-
<p>Several XML-based document formats have a "style" attribute to permit
154-
the author to directly apply style information to specific elements in
155-
documents. If a document format defines a "style" attribute and the
156-
attribute accepts CSS as its value, then this specification describes the
157-
attribute's syntax and interpretation.
152+
<p>Some document formats have a <dfn id=styling-attribute>styling
153+
attribute</dfn> to permit the author to directly apply style information
154+
to specific elements in documents. If a document format defines a styling
155+
attribute and the attribute accepts CSS as its value, then this
156+
specification defines this <dfn id=css-styling-attribute>CSS styling
157+
attribute</dfn>&lsquo;<code class=css>s syntax and interpretation. </code>
158158

159159
<div class=example>
160160
<p>The following example shows the use of the <code>style</code> attribute
@@ -163,72 +163,22 @@ <h2 id=intro><span class=secno>1. </span>Introduction</h2>
163163
<pre>&lt;p style="<em>color: #090; line-height: 1.2</em>"&gt;...&lt;/p&gt;</pre>
164164
</div>
165165

166-
<h2 id=syntax><span class=secno>2. </span>Syntax</h2>
167-
168-
<p>The syntax of the style attribute syntax is exactly the same as the
169-
contents of a CSS <a
170-
href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
171-
block</a>. A close brace (<code>}</code>) in the style attribute value
172-
does not terminate the style data; it is merely an invalid token.
173-
174-
<p>The same rules for forward-compatible parsing apply to the inline style
175-
sheet as to a normal style sheet. See <a
176-
href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
177-
specification</a>. <a href="#CSS21"
178-
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
179-
180-
<h2 id=grammar><span class=secno>3. </span>Grammar</h2>
181-
182-
<p>The syntax of the CSS fragment that is allowed in the HTML "style"
183-
attribute can be formally specified as follows:
184-
185-
<pre>
186-
inline-stylesheet
187-
: S* declaration-list
188-
;
189-
190-
declaration-list
191-
: declaration [ ';' S* declaration ]*
192-
;
193-
</pre>
194-
195-
<p>Please refer to the grammar in <a
196-
href="http://www.w3.org/TR/CSS21/grammar.html">appendix D of the CSS2.1
197-
specification</a> <a href="#CSS21"
198-
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> for the definition of the
199-
symbols not defined here.
200-
201-
<h2 id=interpret><span class=secno>4. </span>Cascading and Interpretation</h2>
202-
203-
<p>The declarations in a style attribute apply to the element to which the
204-
attribute belongs. CSS2.1 <a
205-
href="/TR/CSS21/cascade.html#specificity">defines</a> how style sheets and
206-
"style" attributes are cascaded together. <a href="#CSS21"
207-
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Aside from the differences in
208-
cascading, the declarations in a style attribute must be interpreted
209-
exactly as if they were given in a CSS style rule applied to the element.
210-
211-
<p>The CSS Working Group strongly recommends that document languages do not
212-
allow multiple style attributes on a single element. If a document
213-
language allows multiple style attributes, each is parsed independently
214-
and treated as a separate style rule, the ordering of which should be
215-
defined by the document language, else is undefined.
216-
217-
<h2 id=conformance><span class=secno>5. </span>Conformance</h2>
166+
<h2 id=conformance><span class=secno>2. </span>Conformance</h2>
218167

219-
<p>A document or implementation cannot conform to CSS Style Attribute
220-
Syntax Level 1 alone, but can claim conformance to CSS Style Attribute
168+
<p>A document or implementation cannot conform to CSS Styling Attribute
169+
Syntax Level 1 alone, but can claim conformance to CSS Styling Attribute
221170
Syntax Level 1 if it satisfies the conformance requirements in this
222-
specification when implementing CSS together with style attribute handling
223-
as defined in a document language that has style attributes.
171+
specification when implementing CSS together with styling attribute
172+
handling as defined in a document language that has CSS styling
173+
attributes.
224174

225-
<p>Conformance to CSS Style Attribute Syntax Level 1 is defined for two
175+
<p>Conformance to CSS Styling Attribute Syntax Level 1 is defined for two
226176
classes:
227177

228178
<dl>
229179
<dt><dfn id=document>document</dfn>
230180

231-
<dd>A document represented in a document language that defines a style
181+
<dd>A document represented in a document language that defines a styling
232182
attribute for one or more of its elements.
233183

234184
<dt><dfn id=interpreter>interpreter</dfn>
@@ -262,6 +212,64 @@ <h2 id=conformance><span class=secno>5. </span>Conformance</h2>
262212

263213
<p class=note>Note, this is an informative note.
264214

215+
<h2 id=syntax><span class=secno>3. </span>Syntax and Parsing</h2>
216+
217+
<p>The value of the styling attribute must match the syntax of the contents
218+
of a CSS <a
219+
href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">declaration
220+
block</a>. The interpreter must parse the styling attribute&rsquo;s value
221+
using the same forward-compatible parsing rules that apply to parsing
222+
declaration block contents in a normal CSS style sheet. See <a
223+
href="http://www.w3.org/TR/CSS21/syndata.html">chapter 4 of the CSS2.1
224+
specification</a>. <a href="#CSS21"
225+
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
226+
227+
<p class=note>Note that because there is no open brace delimiting the
228+
declaration list in the CSS styling attribute syntax, a close brace
229+
(<code>}</code>) in the styling attribute's value does not terminate the
230+
style data: it is merely an invalid token.
231+
232+
<h2 id=grammar><span class=secno>4. </span>Grammar</h2>
233+
234+
<p>The syntax of the CSS fragment that is allowed as the CSS styling
235+
attribute's value is formally specified as follows:
236+
237+
<pre>
238+
inline-stylesheet
239+
: S* declaration-list
240+
;
241+
242+
declaration-list
243+
: declaration [ ';' S* declaration ]*
244+
;
245+
</pre>
246+
247+
<p>Please refer to the grammar in <a
248+
href="http://www.w3.org/TR/CSS21/grammar.html">appendix D of the CSS2.1
249+
specification</a> <a href="#CSS21"
250+
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> for the definition of the
251+
symbols not defined here.
252+
253+
<h2 id=interpret><span class=secno>5. </span>Cascading and Interpretation</h2>
254+
255+
<p>The declarations in a styling attribute apply to the element to which
256+
the attribute belongs. CSS2.1 <a
257+
href="/TR/CSS21/cascade.html#specificity">defines</a> how style sheets and
258+
styling attributes are cascaded together. <a href="#CSS21"
259+
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Relative URLs in the style
260+
data must be resolved relative to the styling attribute's element (or to
261+
the document if per-element resolution is not defined).
262+
263+
<p>Aside from the differences in cascading, the declarations in a styling
264+
attribute must be interpreted exactly as if they were given in a CSS style
265+
rule that applies to the element.
266+
267+
<p>The CSS Working Group strongly recommends that document languages do not
268+
allow multiple CSS styling attributes on a single element. If a document
269+
language allows multiple CSS styling attributes, each must be parsed
270+
independently and treated as a separate style rule, the ordering of which
271+
should be defined by the document language, else is undefined.
272+
265273
<h2 id=ack><span class=secno>6. </span>Acknowledgments</h2>
266274

267275
<p>Thanks to feedback from Daniel Glazman, Ian Hickson, Eric A. Meyer,

0 commit comments

Comments
 (0)