|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-US"> |
| 3 | + <head> |
| 4 | + <meta charset=utf-8> |
| 5 | + <title>CSSOM Values Module</title> |
| 6 | + <style> |
| 7 | + .idl { border:solid thin; background:#eee; color:#000; padding:0.5em } |
| 8 | + .idl :link, .idl :visited { color:inherit; background:transparent } |
| 9 | + dfn { font-weight:bold; font-style:normal } |
| 10 | + .example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc } |
| 11 | + .example table code { color:inherit } |
| 12 | + td, th { padding:.1em } |
| 13 | + .note { margin-left:2em; color:green; font-style:italic; font-weight:bold } |
| 14 | + p.note::before { content:"Note: " } |
| 15 | + .XXX { padding:.5em; border:solid red } |
| 16 | + p.XXX::before { content:"Issue: " } |
| 17 | + dl.switch { padding-left:2em } |
| 18 | + dl.switch > dt { text-indent:-1.5em } |
| 19 | + dl.switch > dt:before { content:'\21AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em } |
| 20 | + code { color:orangered } |
| 21 | + code :link, code :visited { color:inherit } |
| 22 | + </style> |
| 23 | + <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-[STATUS]"> |
| 24 | + </head> |
| 25 | + <body class="draft"> |
| 26 | + <div class="head"> |
| 27 | + <!--logo--> |
| 28 | + |
| 29 | + <h1 id="cssom-values">CSSOM Values Module</h1> |
| 30 | + |
| 31 | + <h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</h2> |
| 32 | + |
| 33 | + <dl> |
| 34 | + |
| 35 | + <dt>This Version:</dt> |
| 36 | + <dd class=dontpublish><a href="http://dev.w3.org/csswg/cssom-values/">http://dev.w3.org/csswg/cssom-values/</a></dd> |
| 37 | + <dd class=publish><a href="[VERSION]">[VERSION]</a></dd> |
| 38 | + |
| 39 | + <dt class=dontpublish>Participate:</dt> |
| 40 | + <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>) |
| 41 | + <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="https://w3c-test.org/resources.whatwg.org/file-bug.js"></script> |
| 42 | + <dd class=dontpublish><a href="irc://irc.w3.org:6665/css">IRC: #css on W3C</a></dd> |
| 43 | + |
| 44 | + <dt class=publish>Latest Version:</dt> |
| 45 | + <dd class=publish><a href="[LATEST]">[LATEST]</a></dd> |
| 46 | + |
| 47 | + <dt class=publish>Latest Editor's draft:</dt> |
| 48 | + <dd class=publish><a href="http://dev.w3.org/csswg/cssom-values/">http://dev.w3.org/csswg/cssom-values/</a></dd> |
| 49 | + |
| 50 | + <dt class=dontpublish>Previous Version:</dt> |
| 51 | + |
| 52 | + <dt>Editors:</dt> |
| 53 | + <dd><a>Simon Pieters</a> |
| 54 | + (<a href="http://www.opera.com/">Opera Software ASA</a>) |
| 55 | + <<a href="mailto:simponp@opera.com">simonp@opera.com</a>></dd> |
| 56 | + <dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a> |
| 57 | + (<a href="http://www.cox.com/">Cox Communications, Inc.</a>) |
| 58 | + <<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>></dd> |
| 59 | + |
| 60 | + </dl> |
| 61 | + |
| 62 | + <!--copyright--> |
| 63 | + |
| 64 | + </div> |
| 65 | + |
| 66 | + <hr class="top"> |
| 67 | + |
| 68 | + <h2 class="no-num no-toc" id="abstract">Abstract</h2> |
| 69 | + |
| 70 | + <p>This CSSOM Values module defines APIs for accessing and manipulating CSS property |
| 71 | + values using object oriented value representations. These APIs are intended to replace |
| 72 | + the underimplemented and underutilized <code title>CSSValue</code> and related APIs defined by |
| 73 | + <span class=informative data-anolis-ref>DOM2STYLE</span>.</p> |
| 74 | + |
| 75 | + |
| 76 | + <h2 class="no-num no-toc" id="sotd">Status of this Document</h2> |
| 77 | + |
| 78 | + <p><em>This section describes the status of this document at the time of |
| 79 | + its publication. Other documents may supersede this document. A list of |
| 80 | + current W3C publications and the latest revision of this technical report |
| 81 | + can be found in the |
| 82 | + <a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em> |
| 83 | + |
| 84 | + <p>This is the [DATE: 3 August 2002] [LONGSTATUS] of CSSOM. Please send |
| 85 | + comments to |
| 86 | + <a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a> |
| 87 | + (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) |
| 88 | + with <samp>[cssom-values]</samp> at the start of the subject line. |
| 89 | + |
| 90 | + |
| 91 | + <!-- XXX include this text upon FPWD publishing |
| 92 | + <p>This is the [DATE] First Public Working Draft of CSSOM, produced by the |
| 93 | + <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part |
| 94 | + of the <a href="http://www.w3.org/Style/">Style Activity</a>). |
| 95 | + --> |
| 96 | + <!--XXX remove "First Public" after initial publication --> |
| 97 | + |
| 98 | + <p>This document was produced by a group operating under the |
| 99 | + <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. |
| 100 | + W3C maintains a |
| 101 | + <a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel=disclosure>public list of any patent disclosures</a> |
| 102 | + made in connection with the deliverables of the group; that page also |
| 103 | + includes instructions for disclosing a patent. An individual who has |
| 104 | + actual knowledge of a patent which the individual believes contains |
| 105 | + <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> |
| 106 | + must disclose the information in accordance with |
| 107 | + <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p> |
| 108 | + |
| 109 | + <p>Publication as a Working Draft does not imply endorsement by the W3C |
| 110 | + Membership. This is a draft document and may be updated, replaced or |
| 111 | + obsoleted by other documents at any time. It is inappropriate to cite this |
| 112 | + document as other than work in progress.</p> |
| 113 | + |
| 114 | + <h2 class="no-num no-toc" id="toc">Table of Contents</h2> |
| 115 | + |
| 116 | + <!--toc--> |
| 117 | + |
| 118 | + <h2>Introduction</h2> |
| 119 | + |
| 120 | + <p>This CSSOM Values module defines APIs for accessing and manipulating CSS property |
| 121 | + values using object oriented value representations.</p> |
| 122 | + |
| 123 | + <h2>Conformance</h2> |
| 124 | + |
| 125 | + <p>All diagrams, examples, and notes in this specification are |
| 126 | + non-normative, as are all sections explicitly marked non-normative. |
| 127 | + Everything else in this specification is normative. |
| 128 | + |
| 129 | + <p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL |
| 130 | + NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and |
| 131 | + "OPTIONAL" in the normative parts of this document are to be |
| 132 | + interpreted as described in RFC2119. For readability, these words do |
| 133 | + not appear in all uppercase letters in this specification. |
| 134 | + <span data-anolis-ref>RFC2119</span> |
| 135 | + |
| 136 | + <p>Requirements phrased in the imperative as part of algorithms |
| 137 | + (such as "strip any leading space characters" or "return false and |
| 138 | + terminate these steps") are to be interpreted with the meaning of the |
| 139 | + key word ("must", "should", "may", etc) used in introducing the |
| 140 | + algorithm. |
| 141 | + |
| 142 | + <p>Conformance requirements phrased as algorithms or specific steps |
| 143 | + may be implemented in any manner, so long as the end result is |
| 144 | + equivalent. (In particular, the algorithms defined in this |
| 145 | + specification are intended to be easy to follow, and not intended to |
| 146 | + be performant.) |
| 147 | + |
| 148 | + <p>Unless otherwise stated, string comparisons are done in a |
| 149 | + <span data-anolis-spec=dom>case-sensitive</span> manner. |
| 150 | + |
| 151 | + <h3>Dependencies</h3> |
| 152 | + |
| 153 | + <p>This specification relies upon the following underlying specifications:</p> |
| 154 | + |
| 155 | + <dl> |
| 156 | + |
| 157 | + <dt>CSSOM</dt> |
| 158 | + <dd><p>A <span>conforming user agent</span> must support the <span>CSS Object |
| 159 | + Model</span> <span data-anolis-ref>CSSOM</span>.</p> |
| 160 | + <p class="XXX">Narrow this dependency to specific features of CSSOM.</p> |
| 161 | + </dd> |
| 162 | + |
| 163 | + </dl> |
| 164 | + |
| 165 | + <h2>CSS Values</h2> |
| 166 | + |
| 167 | + <h3>The <code title>CSSStyleDeclaration</code> Interface</h3> |
| 168 | + |
| 169 | + <pre class="idl">partial interface <dfn>CSSStyleDeclaration</dfn> { |
| 170 | + readonly attribute <span>CSSStyleDeclarationValue</span> <span title="dom-CSSStyleDeclaration-values">values</span>; |
| 171 | +};</pre> |
| 172 | + |
| 173 | + <h3>The <code title>CSSStyleDeclarationValue</code> Interface</h3> |
| 174 | + |
| 175 | + <pre class="idl">interface <dfn>CSSStyleDeclarationValue</dfn> { |
| 176 | + // CSS Properties |
| 177 | +<!--CSSOM-DECLARATIONVALUEIDL--> |
| 178 | +};</pre> |
| 179 | + |
| 180 | + <p class="XXX">The rough idea is that this interface exposes the full |
| 181 | + list of supported properties as well that each return a |
| 182 | + <code>CSSPropertyValue</code> object. That object can implement other |
| 183 | + objects depending on the property involved. E.g. for '<code>width</code>' |
| 184 | + the object would implement <code>CSSLengthComponentValue</code> and |
| 185 | + <code>CSSPercentageComponentValue</code>.</p> |
| 186 | + |
| 187 | + <h3>The <code title>CSSPropertyValue</code> Interface</h3> |
| 188 | + |
| 189 | + <pre class="idl">interface <dfn>CSSPropertyValue</dfn> { |
| 190 | + attribute DOMString <span title="dom-CSSPropertyValue-cssText">cssText</span>; |
| 191 | +};</pre> |
| 192 | + |
| 193 | + <!-- |
| 194 | + what does the CSSValue represent |
| 195 | + "map" |
| 196 | + "list" |
| 197 | + "space-list" |
| 198 | + "component" |
| 199 | +
|
| 200 | + if it is a CSSComponentValue |
| 201 | +
|
| 202 | + --> |
| 203 | + |
| 204 | + <h3>The <code title>CSSPropertyValueList</code> Interface</h3> |
| 205 | + |
| 206 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSPropertyValueList</dfn> { |
| 207 | + readonly attribute <span>CSSValue</span>[] <span title="dom-CSSPropertyValue-list">list</span>; |
| 208 | +};</pre> |
| 209 | + |
| 210 | + <p class="XXX">Ideally this attribute just returns a mutable array.</p> |
| 211 | + |
| 212 | + <h3>The <code title>CSSMapValue</code> Interface</h3> |
| 213 | + |
| 214 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSMapValue</dfn> { |
| 215 | + getter <span>CSSValue</span> (DOMString <var title>name</var>); |
| 216 | +};</pre> |
| 217 | + <!-- see HTML5 DOMStringMap --> |
| 218 | + |
| 219 | + <p class="XXX">This seems the simplest we can get away with.</p> |
| 220 | + |
| 221 | + <h3>The <code title>CSSComponentValue</code> Interface</h3> |
| 222 | + |
| 223 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSComponentValue</dfn> { |
| 224 | + readonly attribute DOMString <span title="dom-CSSComponentValue-type">type</span>; |
| 225 | + attribute any <span title="dom-CSSComponentValue-value">value</span>; |
| 226 | +};</pre> |
| 227 | + |
| 228 | + <p class="XXX">type returns "string", "keyword", "identifier", "color", "em", "ex", "px", "url".</p> |
| 229 | + |
| 230 | + <h4>The <code title>CSSColorComponentValue</code> Interface</h4> |
| 231 | + |
| 232 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSColorComponentValue</dfn> { |
| 233 | + attribute short <span title="dom-CSSColorComponentValue-red">red</span>; |
| 234 | + attribute short <span title="dom-CSSColorComponentValue-green">green</span>; |
| 235 | + attribute short <span title="dom-CSSColorComponentValue-blue">blue</span>; |
| 236 | + attribute float <span title="dom-CSSColorComponentValue-alpha">alpha</span>; |
| 237 | +};</pre> |
| 238 | + |
| 239 | + <p class="XXX">We can make this more complex later. This will probably move into the CSS Color Level 4.</p> |
| 240 | + |
| 241 | + <h4>The <code title>CSSIdentifierComponentValue</code> Interface</h4> |
| 242 | + |
| 243 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSIdentifierComponentValue</dfn> { |
| 244 | + attribute DOMString <span title="dom-CSSStringComponentValue-identifier">identifier</span>; |
| 245 | +};</pre> |
| 246 | + |
| 247 | + <h4>The <code title>CSSKeywordComponentValue</code> Interface</h4> |
| 248 | + |
| 249 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSKeywordComponentValue</dfn> { |
| 250 | + attribute DOMString <span title="dom-CSSStringComponentValue-keyword">keyword</span>; |
| 251 | +};</pre> |
| 252 | + |
| 253 | + <h4>The <code title>CSSLengthComponentValue</code> Interface</h4> |
| 254 | + |
| 255 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSLengthComponentValue</dfn> { |
| 256 | + attribute float <span title="dom-CSSLengthComponentValue-em">em</span>; |
| 257 | + attribute float <span title="dom-CSSLengthComponentValue-ex">ex</span>; |
| 258 | + attribute float <span title="dom-CSSLengthComponentValue-px">px</span>; |
| 259 | + <span class="XXX">// figure out what to do with absolute lengths</span> |
| 260 | +};</pre> |
| 261 | + |
| 262 | + <h4>The <code title>CSSPercentageComponentValue</code> Interface</h4> |
| 263 | + |
| 264 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSPercentageComponentValue</dfn> { |
| 265 | + attribute float <span title="dom-CSSPercentageComponentValue">percent</span>; |
| 266 | +};</pre> |
| 267 | + |
| 268 | + <h4>The <code title>CSSStringComponentValue</code> Interface</h4> |
| 269 | + |
| 270 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSStringComponentValue</dfn> { |
| 271 | + attribute DOMString <span title="dom-CSSStringComponentValue-string">string</span>; |
| 272 | +};</pre> |
| 273 | + |
| 274 | + <h4>The <code title>CSSURLComponentValue</code> Interface</h4> |
| 275 | + |
| 276 | + <pre class="idl">[NoInterfaceObject] interface <dfn>CSSURLComponentValue</dfn> { |
| 277 | + attribute DOMString? <span title="dom-CSSURLComponentValue-url">url</span>; |
| 278 | +};</pre> |
| 279 | + |
| 280 | + |
| 281 | + |
| 282 | +<h2 class=no-num>References</h2> |
| 283 | +<div id=anolis-references></div> |
| 284 | + |
| 285 | + |
| 286 | + <h2 class="no-num" id="acknowledgments">Acknowledgments</h2> |
| 287 | + |
| 288 | + <p>The editors would like to thank |
| 289 | + |
| 290 | + Alexey Feldgendler, |
| 291 | + Björn Höhrmann, |
| 292 | + Brian Kardell, |
| 293 | + Christian Krebs, |
| 294 | + Daniel Glazman, |
| 295 | + David Baron, |
| 296 | + <i>fantasai</i>, |
| 297 | + Hallvord R. M. Steen, |
| 298 | + Ian Hickson, |
| 299 | + John Daggett, |
| 300 | + Lachlan Hunt, |
| 301 | + Morten Stenshorne, |
| 302 | + Philip Taylor, |
| 303 | + Robert O'Callahan, |
| 304 | + Sjoerd Visscher, |
| 305 | + <!--Simon Pieters,--> |
| 306 | + Sylvain Galineau, |
| 307 | + Tarquin Wilton-Jones, and |
| 308 | + Zack Weinberg |
| 309 | + |
| 310 | + for contributing to this specification.</p> |
| 311 | + |
| 312 | + <p>Special thanks to Anne van Kesteren who authored the material upon which this work is based.</p> |
| 313 | + |
| 314 | + <!-- XXX NOTES |
| 315 | +
|
| 316 | + --> |
| 317 | + </body> |
| 318 | +</html> |
| 319 | + |
0 commit comments