-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
375 lines (265 loc) · 19.8 KB
/
Overview.html
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
<!DOCTYPE html><html lang="en-US"><head>
<meta charset="utf-8">
<title>CSSOM Values Module</title>
<link href="../default.css" rel="stylesheet">
<link href="https://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet">
</head>
<body class="draft">
<div class="head">
<!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"></a></p>
<!--end-logo-->
<h1>CSSOM Values Module</h1>
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 8 January 2014</h2>
<dl>
<dt>This Version:</dt>
<dd class="dontpublish"><a href="http://dev.w3.org/csswg/cssom-values/">http://dev.w3.org/csswg/cssom-values/</a></dd>
<dt class="dontpublish">Participate:</dt>
<dd class="dontpublish"><a href="mailto:www-style@w3.org?subject=%5Bcssom-values%5D%20">www-style@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
<dd class="dontpublish"><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&component=CSSOM%20Values">File a bug</a> (<a href="https://www.w3.org/Bugs/Public/buglist.cgi?component=CSSOM%20Values&product=CSS&resolution=---">open bugs</a>) <script async="" src="http://resources.whatwg.org/file-bug.js"></script>
<dd class="dontpublish"><a href="irc://irc.w3.org:6665/css">IRC: #css on W3C</a></dd>
<dt class="dontpublish">Previous Version:</dt>
<dt>Editors:</dt>
<dd>Simon Pieters
(<a href="http://www.opera.com/">Opera Software ASA</a>)
<<a href="mailto:simonp@opera.com">simonp@opera.com</a>></dd>
<dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
(<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
<<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>></dd>
</dl>
<!--begin-copyright-->
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2014 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</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-->
</div>
<hr class="top">
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This CSSOM Values module defines APIs for accessing and manipulating CSS property
values using object oriented value representations. These APIs are intended to replace
the underimplemented and underutilized <code title="">CSSValue</code> and related APIs defined by
<a class="informative" href="#refsDOM2STYLE">[DOM2STYLE]</a>.</p>
<h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the
<a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
<p>This is the 8 January 2014 Editor's Draft of CSSOM. Please send
comments to
<a href="mailto:www-style@w3.org?subject=%5Bcssom-values%5D%20">www-style@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
with <samp>[cssom-values]</samp> at the start of the subject line.
<!-- XXX include this text upon FPWD publishing
<p>This is the 8 January 2014 First Public Working Draft of CSSOM, produced by the
<a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part
of the <a href="http://www.w3.org/Style/">Style Activity</a>).
-->
<!--XXX remove "First Public" after initial publication -->
<p>This document was produced by a group operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
W3C maintains a
<a href="http://www.w3.org/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. An individual who has
actual knowledge of a patent which the individual believes contains
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
must disclose the information in accordance with
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
<p>Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress.</p>
<h2 class="no-num no-toc" id="toc">Table of Contents</h2>
<!--begin-toc-->
<ul class="toc">
<li><a href="#introduction"><span class="secno">1 </span>Introduction</a></li>
<li><a href="#conformance"><span class="secno">2 </span>Conformance</a>
<ul class="toc">
<li><a href="#dependencies"><span class="secno">2.1 </span>Dependencies</a></ul></li>
<li><a href="#css-values"><span class="secno">3 </span>CSS Values</a>
<ul class="toc">
<li><a href="#the-cssvalue-interface"><span class="secno">3.1 </span>The <code title="">CSSValue</code> Interface</a></li>
<li><a href="#the-cssstyledeclaration-interface"><span class="secno">3.2 </span>The <code title="">CSSStyleDeclaration</code> Interface</a></li>
<li><a href="#the-cssstyledeclarationvalue-interface"><span class="secno">3.3 </span>The <code title="">CSSStyleDeclarationValue</code> Interface</a></li>
<li><a href="#the-csspropertyvalue-interface"><span class="secno">3.4 </span>The <code title="">CSSPropertyValue</code> Interface</a></li>
<li><a href="#the-csspropertyvaluelist-interface"><span class="secno">3.5 </span>The <code title="">CSSPropertyValueList</code> Interface</a></li>
<li><a href="#the-cssmapvalue-interface"><span class="secno">3.6 </span>The <code title="">CSSMapValue</code> Interface</a></li>
<li><a href="#the-csscomponentvalue-interface"><span class="secno">3.7 </span>The <code title="">CSSComponentValue</code> Interface</a>
<ul class="toc">
<li><a href="#the-csscolorcomponentvalue-interface"><span class="secno">3.7.1 </span>The <code title="">CSSColorComponentValue</code> Interface</a></li>
<li><a href="#the-cssidentifiercomponentvalue-interface"><span class="secno">3.7.2 </span>The <code title="">CSSIdentifierComponentValue</code> Interface</a></li>
<li><a href="#the-csskeywordcomponentvalue-interface"><span class="secno">3.7.3 </span>The <code title="">CSSKeywordComponentValue</code> Interface</a></li>
<li><a href="#the-csslengthcomponentvalue-interface"><span class="secno">3.7.4 </span>The <code title="">CSSLengthComponentValue</code> Interface</a></li>
<li><a href="#the-csspercentagecomponentvalue-interface"><span class="secno">3.7.5 </span>The <code title="">CSSPercentageComponentValue</code> Interface</a></li>
<li><a href="#the-cssstringcomponentvalue-interface"><span class="secno">3.7.6 </span>The <code title="">CSSStringComponentValue</code> Interface</a></li>
<li><a href="#the-cssurlcomponentvalue-interface"><span class="secno">3.7.7 </span>The <code title="">CSSURLComponentValue</code> Interface</a></ul></ul></li>
<li><a class="no-num" href="#references">References</a></li>
<li><a class="no-num" href="#acknowledgments">Acknowledgments</a></ul>
<!--end-toc-->
<h2 id="introduction"><span class="secno">1 </span>Introduction</h2>
<p>This CSSOM Values module defines APIs for accessing and manipulating CSS property
values using object oriented value representations.</p>
<h2 id="conformance"><span class="secno">2 </span>Conformance</h2>
<p>All diagrams, examples, and notes in this specification are
non-normative, as are all sections explicitly marked non-normative.
Everything else in this specification is normative.
<p>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 RFC2119. For readability, these words do
not appear in all uppercase letters in this specification.
<a href="#refsRFC2119">[RFC2119]</a>
<p>Requirements phrased in the imperative as part of algorithms
(such as "strip any leading space characters" or "return false and
terminate these steps") are to be interpreted with the meaning of the
key word ("must", "should", "may", etc) used in introducing the
algorithm.
<p>Conformance requirements phrased as algorithms or specific steps
may be implemented in any manner, so long as the end result is
equivalent. (In particular, the algorithms defined in this
specification are intended to be easy to follow, and not intended to
be performant.)
<p>Unless otherwise stated, string comparisons are done in a
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> manner.
<h3 id="dependencies"><span class="secno">2.1 </span>Dependencies</h3>
<p>This specification relies upon the following underlying specifications:</p>
<dl>
<dt>CSSOM</dt>
<dd><p>A conforming user agent must support the CSS Object
Model. <a href="#refsCSSOM">[CSSOM]</a></p>
<p class="issue">Narrow this dependency to specific features of CSSOM.</p>
</dd>
</dl>
<h2 id="css-values"><span class="secno">3 </span>CSS Values</h2>
<h3 id="the-cssvalue-interface"><span class="secno">3.1 </span>The <code title="">CSSValue</code> Interface</h3>
<pre class="idl">interface <dfn id="cssvalue">CSSValue</dfn> {
<span class="issue" title="">// ...</span>
};</pre>
<h3 id="the-cssstyledeclaration-interface"><span class="secno">3.2 </span>The <code title="">CSSStyleDeclaration</code> Interface</h3>
<pre class="idl">partial interface <dfn id="cssstyledeclaration">CSSStyleDeclaration</dfn> {
readonly attribute <a href="#cssstyledeclarationvalue">CSSStyleDeclarationValue</a> <a href="#dom-cssstyledeclaration-values" title="dom-CSSStyleDeclaration-values">values</a>;
};</pre>
<p class="issue"><dfn id="dom-cssstyledeclaration-values" title="dom-CSSStyleDeclaration-values"><code>values</code></dfn>
<h3 id="the-cssstyledeclarationvalue-interface"><span class="secno">3.3 </span>The <code title="">CSSStyleDeclarationValue</code> Interface</h3>
<pre class="idl">interface <dfn id="cssstyledeclarationvalue">CSSStyleDeclarationValue</dfn> {
// CSS Properties
<!--CSSOM-DECLARATIONVALUEIDL-->
};</pre>
<p class="issue">The rough idea is that this interface exposes the full
list of supported properties as well that each return a
<code><a href="#csspropertyvalue">CSSPropertyValue</a></code> object. That object can implement other
objects depending on the property involved. E.g. for '<code title="">width</code>'
the object would implement <code><a href="#csslengthcomponentvalue">CSSLengthComponentValue</a></code> and
<code><a href="#csspercentagecomponentvalue">CSSPercentageComponentValue</a></code>.</p>
<h3 id="the-csspropertyvalue-interface"><span class="secno">3.4 </span>The <code title="">CSSPropertyValue</code> Interface</h3>
<pre class="idl">interface <dfn id="csspropertyvalue">CSSPropertyValue</dfn> {
attribute DOMString <a href="#dom-csspropertyvalue-csstext" title="dom-CSSPropertyValue-cssText">cssText</a>;
};</pre>
<p class="issue"><dfn id="dom-csspropertyvalue-csstext" title="dom-CSSPropertyValue-cssText"><code>cssText</code></dfn>
<!--
what does the CSSValue represent
"map"
"list"
"space-list"
"component"
if it is a CSSComponentValue
-->
<h3 id="the-csspropertyvaluelist-interface"><span class="secno">3.5 </span>The <code title="">CSSPropertyValueList</code> Interface</h3>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csspropertyvaluelist">CSSPropertyValueList</dfn> {
readonly attribute <a href="#cssvalue">CSSValue</a>[] <a href="#dom-csspropertyvalue-list" title="dom-CSSPropertyValue-list">list</a>;
};</pre>
<p class="issue"><dfn id="dom-csspropertyvalue-list" title="dom-CSSPropertyValue-list"><code>list</code></dfn>
<p class="issue">Ideally this attribute just returns a mutable array.</p>
<h3 id="the-cssmapvalue-interface"><span class="secno">3.6 </span>The <code title="">CSSMapValue</code> Interface</h3>
<pre class="idl">[NoInterfaceObject] interface <dfn id="cssmapvalue">CSSMapValue</dfn> {
getter <a href="#cssvalue">CSSValue</a> (DOMString <var>name</var>);
};</pre>
<!-- see HTML5 DOMStringMap -->
<p class="issue">This seems the simplest we can get away with.</p>
<h3 id="the-csscomponentvalue-interface"><span class="secno">3.7 </span>The <code title="">CSSComponentValue</code> Interface</h3>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csscomponentvalue">CSSComponentValue</dfn> {
readonly attribute DOMString <a href="#dom-csscomponentvalue-type" title="dom-CSSComponentValue-type">type</a>;
attribute any <a href="#dom-csscomponentvalue-value" title="dom-CSSComponentValue-value">value</a>;
};</pre>
<p class="issue"><dfn id="dom-csscomponentvalue-type" title="dom-CSSComponentValue-type"><code>type</code></dfn>
<p class="issue"><dfn id="dom-csscomponentvalue-value" title="dom-CSSComponentValue-value"><code>value</code></dfn>
<p class="issue">type returns "string", "keyword", "identifier", "color", "em", "ex", "px", "url".</p>
<h4 id="the-csscolorcomponentvalue-interface"><span class="secno">3.7.1 </span>The <code title="">CSSColorComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csscolorcomponentvalue">CSSColorComponentValue</dfn> {
attribute short <a href="#dom-csscolorcomponentvalue-red" title="dom-CSSColorComponentValue-red">red</a>;
attribute short <a href="#dom-csscolorcomponentvalue-green" title="dom-CSSColorComponentValue-green">green</a>;
attribute short <a href="#dom-csscolorcomponentvalue-blue" title="dom-CSSColorComponentValue-blue">blue</a>;
attribute float <a href="#dom-csscolorcomponentvalue-alpha" title="dom-CSSColorComponentValue-alpha">alpha</a>;
};</pre>
<p class="issue"><dfn id="dom-csscolorcomponentvalue-red" title="dom-CSSColorComponentValue-red"><code>red</code></dfn>
<p class="issue"><dfn id="dom-csscolorcomponentvalue-green" title="dom-CSSColorComponentValue-green"><code>green</code></dfn>
<p class="issue"><dfn id="dom-csscolorcomponentvalue-blue" title="dom-CSSColorComponentValue-blue"><code>blue</code></dfn>
<p class="issue"><dfn id="dom-csscolorcomponentvalue-alpha" title="dom-CSSColorComponentValue-alpha"><code>alpha</code></dfn>
<p class="issue">We can make this more complex later. This will probably move into the CSS Color Level 4.</p>
<h4 id="the-cssidentifiercomponentvalue-interface"><span class="secno">3.7.2 </span>The <code title="">CSSIdentifierComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="cssidentifiercomponentvalue">CSSIdentifierComponentValue</dfn> {
attribute DOMString <a href="#dom-cssstringcomponentvalue-identifier" title="dom-CSSStringComponentValue-identifier">identifier</a>;
};</pre>
<p class="issue"><dfn id="dom-cssstringcomponentvalue-identifier" title="dom-CSSStringComponentValue-identifier"><code>identifier</code></dfn>
<h4 id="the-csskeywordcomponentvalue-interface"><span class="secno">3.7.3 </span>The <code title="">CSSKeywordComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csskeywordcomponentvalue">CSSKeywordComponentValue</dfn> {
attribute DOMString <a href="#dom-cssstringcomponentvalue-keyword" title="dom-CSSStringComponentValue-keyword">keyword</a>;
};</pre>
<p class="issue"><dfn id="dom-cssstringcomponentvalue-keyword" title="dom-CSSStringComponentValue-keyword"><code>keyword</code></dfn>
<h4 id="the-csslengthcomponentvalue-interface"><span class="secno">3.7.4 </span>The <code title="">CSSLengthComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csslengthcomponentvalue">CSSLengthComponentValue</dfn> {
attribute float <a href="#dom-csslengthcomponentvalue-em" title="dom-CSSLengthComponentValue-em">em</a>;
attribute float <a href="#dom-csslengthcomponentvalue-ex" title="dom-CSSLengthComponentValue-ex">ex</a>;
attribute float <a href="#dom-csslengthcomponentvalue-px" title="dom-CSSLengthComponentValue-px">px</a>;
<span class="issue" title="">// figure out what to do with absolute lengths</span>
};</pre>
<p class="issue"><dfn id="dom-csslengthcomponentvalue-em" title="dom-CSSLengthComponentValue-em"><code>em</code></dfn>
<p class="issue"><dfn id="dom-csslengthcomponentvalue-ex" title="dom-CSSLengthComponentValue-ex"><code>ex</code></dfn>
<p class="issue"><dfn id="dom-csslengthcomponentvalue-px" title="dom-CSSLengthComponentValue-px"><code>px</code></dfn>
<h4 id="the-csspercentagecomponentvalue-interface"><span class="secno">3.7.5 </span>The <code title="">CSSPercentageComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="csspercentagecomponentvalue">CSSPercentageComponentValue</dfn> {
attribute float <a href="#dom-csspercentagecomponentvalue-percent" title="dom-CSSPercentageComponentValue-percent">percent</a>;
};</pre>
<p class="issue"><dfn id="dom-csspercentagecomponentvalue-percent" title="dom-CSSPercentageComponentValue-percent"><code>percent</code></dfn>
<h4 id="the-cssstringcomponentvalue-interface"><span class="secno">3.7.6 </span>The <code title="">CSSStringComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="cssstringcomponentvalue">CSSStringComponentValue</dfn> {
attribute DOMString <a href="#dom-cssstringcomponentvalue-string" title="dom-CSSStringComponentValue-string">string</a>;
};</pre>
<p class="issue"><dfn id="dom-cssstringcomponentvalue-string" title="dom-CSSStringComponentValue-string"><code>string</code></dfn>
<h4 id="the-cssurlcomponentvalue-interface"><span class="secno">3.7.7 </span>The <code title="">CSSURLComponentValue</code> Interface</h4>
<pre class="idl">[NoInterfaceObject] interface <dfn id="cssurlcomponentvalue">CSSURLComponentValue</dfn> {
attribute DOMString? <a href="#dom-cssurlcomponentvalue-url" title="dom-CSSURLComponentValue-url">url</a>;
};</pre>
<p class="issue"><dfn id="dom-cssurlcomponentvalue-url" title="dom-CSSURLComponentValue-url"><code>url</code></dfn>
<h2 class="no-num" id="references">References</h2>
<div id="anolis-references"><dl><dt id="refsCSSOM">[CSSOM]
<dd><cite><a href="http://dev.w3.org/csswg/cssom/">CSS Object Model (CSSOM)</a></cite>, Simon Pieters and Glenn Adams. W3C.
<dt id="refsDOM2STYLE">[DOM2STYLE]
<dd>(Non-normative) <cite><a href="http://www.w3.org/TR/DOM-Level-2-Style/">Document Object Model (DOM) Level 2 Style Specification</a></cite>, Chris Wilson, Philippe Le Hégaret and Vidur Apparao. W3C.
<dt id="refsRFC2119">[RFC2119]
<dd><cite><a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a></cite>, Scott Bradner. IETF.
</dl></div>
<h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
<p>The editors would like to thank
Alexey Feldgendler,
Björn Höhrmann,
Brian Kardell,
Christian Krebs,
Daniel Glazman,
David Baron,
<i>fantasai</i>,
Hallvord R. M. Steen,
Ian Hickson,
John Daggett,
Lachlan Hunt,
Morten Stenshorne,
Philip Taylor,
Robert O'Callahan,
Sjoerd Visscher,
<!--Simon Pieters,-->
Sylvain Galineau,
Tarquin Wilton-Jones, and
Zack Weinberg
for contributing to this specification.</p>
<p>Special thanks to Anne van Kesteren who authored the material upon which this work is based.</p>
<!-- XXX NOTES
-->