- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 30 Sep 2011 19:51:11 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css-variables In directory hutz:/tmp/cvs-serv8256 Modified Files: Overview.html Overview.src.html Log Message: First draft of the legacy CSSOM side of the API. Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css-variables/Overview.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Overview.html 29 Sep 2011 00:27:05 -0000 1.6 +++ Overview.html 30 Sep 2011 19:51:08 -0000 1.7 @@ -29,6 +29,11 @@ } </style> + <style> + pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em } + pre.idl :link, pre.idl :visited { color:inherit; background:transparent } + </style> + <body> <div class=head> <!--begin-logo--> <p><a href="http://www.w3.org/"><img alt=W3C height=48 @@ -36,14 +41,14 @@ <h1>CSS Variables Module Level 1</h1> - <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 29 September + <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 30 September 2011</h2> <dl> <dt>This version: <dd><a - href="http://www.w3.org/TR/2011/ED-css-variables-20110929/">http://dev.w3.org/csswg/css-variables/</a> + href="http://www.w3.org/TR/2011/ED-css-variables-20110930/">http://dev.w3.org/csswg/css-variables/</a> <!--<dt>Latest version: <dd><a href="http://www.w3.org/TR/css-variables/">http://www.w3.org/TR/css-variables/</a>--> @@ -153,6 +158,23 @@ </ul> <li><a href="#cssom"><span class=secno>4. </span> APIs</a> + <ul class=toc> + <li><a href="#cssom-simple"><span class=secno>4.1. </span> The Simple + API</a> + + <li><a href="#cssom-stylesheet"><span class=secno>4.2. </span> Additions + to the Stylesheet Interface</a> + <ul class=toc> + <li><a href="#cssom-cssrule"><span class=secno>4.2.1. </span> Changes + to interface CSSRule</a> + + <li><a href="#cssom-cssvariablerule"><span class=secno>4.2.2. </span> + Interface CSSVariableRule</a> + + <li><a href="#cssom-cssvariable"><span class=secno>4.2.3. </span> + Interface CSSVariableComponentValue</a> + </ul> + </ul> <li><a href="#grammar"><span class=secno>5. </span> The Grammar of Variables</a> @@ -420,13 +442,109 @@ <h2 id=cssom><span class=secno>4. </span> APIs</h2> - <p class=issue>Define the "basic" CSSOM APIs from <a - href="http://disruptive-innovations.com/zoo/cssvariables/#mozTocId847334">Daniel's - and Hyatt's spec</a>. + <p>CSS Variables are mutable - one can change them after they've been + defined, through the CSSOM. This can be done in two ways: one can read the + current variable definition and set an override definition through the + convenient <code>.vars</code> property, or manipulate the definitions in + the stylesheets directly through the standard CSSOM stylesheet interface. + + <h3 id=cssom-simple><span class=secno>4.1. </span> The Simple API</h3> <p class=issue>Define the more convenient CSSOM API from <a href="http://www.xanthir.com/blog/b4AD0">my blog post</a>. + <h3 id=cssom-stylesheet><span class=secno>4.2. </span> Additions to the + Stylesheet Interface</h3> + + <p>This specification extends the IDL definitions in the CSSOM spec <a + href="#CSSOM" rel=biblioentry>[CSSOM]<!--{{!CSSOM}}--></a> in several + ways. + + <h4 id=cssom-cssrule><span class=secno>4.2.1. </span> Changes to interface + CSSRule</h4> + + <dl> + <dt>IDL Definition + + <dd> + <pre class=idl> +interface CSSRule { + + // RuleType + const unsigned short UNKNOWN_RULE = 0; + const unsigned short STYLE_RULE = 1; + const unsigned short CHARSET_RULE = 2; + const unsigned short IMPORT_RULE = 3; + const unsigned short MEDIA_RULE = 4; + const unsigned short FONT_FACE_RULE = 5; + const unsigned short PAGE_RULE = 6; + <ins>const unsigned short <a href="#variablerule"><code>VARIABLE_RULE</code></a> = 11;</ins> + readonly attribute unsigned short type; + attribute DOMString cssText; + // raises(DOMException) on setting + readonly attribute CSSStyleSheet parentStyleSheet; + readonly attribute CSSRule parentRule; +};</pre> + + <dt>Defined Constants + + <dd><dfn id=variablerule><code>VARIABLE_RULE</code></dfn>: The rule is a + <code>CSSVariableRule</code>. + </dl> + + <p class=issue>Going with value 11 for now, since CSSOM seems to reserve + 0-10. + + <h4 id=cssom-cssvariablerule><span class=secno>4.2.2. </span> Interface + CSSVariableRule</h4> + + <p>The <code>CSSVariableRule</code> interface represents a ‘<code + class=css>@var</code>’ rule within a CSS stylesheet. The + ‘<code class=css>@var</code>’ rule is used to define + variables. + + <dl> + <dt>IDL Definition + + <dd> + <pre class=idl> +interface CSSVariableRule : CSSRule { + attribute DOMString name; + attribute DOMString value; +}</pre> + </dl> + + <h4 id=cssom-cssvariable><span class=secno>4.2.3. </span> Interface + CSSVariableComponentValue</h4> + + <p>The CSSVariableComponentValue interface represents a call to a CSS + Variable. + + <dl> + <dt>IDL Definition + + <dd> + <pre class=idl> +[NoInterfaceObject] interface CSSVariableComponentValue { + attribute DOMString variableName; + readonly attribute any variableValue; +}</pre> + + <dt>Attributes + + <dd> + <dl> + <dt><code>variableName</code> of type <code>DOMString</code> + + <dd>This attribute is used for the name of the variable. Changing this + attribute changes the variable being referred to. + + <dt><code>variableValue</code> of type <code>any</code>, readonly + + <dd>This attribute is used for the value of the variable. + </dl> + </dl> + <h2 id=grammar><span class=secno>5. </span> The Grammar of Variables</h2> <p class=issue>I'm not sure if I've done this section correctly. For now, @@ -668,10 +786,19 @@ <dt id=CSS21>[CSS21] <dd>Bert Bos; et al. <a - href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading Style + href="http://www.w3.org/TR/2011/REC-CSS2-20110607/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7 June 2011. W3C Recommendation. URL: <a - href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a> + href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a> + </dd> + <!----> + + <dt id=CSSOM>[CSSOM] + + <dd>Anne van Kesteren. <a + href="http://www.w3.org/TR/2011/WD-cssom-20110712/"><cite>CSSOM.</cite></a> + 12 July 2011. W3C Working Draft. (Work in progress.) URL: <a + href="http://www.w3.org/TR/2011/WD-cssom-20110712/">http://www.w3.org/TR/2011/WD-cssom-20110712/</a> </dd> <!----> @@ -707,9 +834,9 @@ <dt id=CSS3COLOR>[CSS3COLOR] <dd>Tantek Çelik; Chris Lilley; L. David Baron. <a - href="http://www.w3.org/TR/2011/REC-css3-color-20110607"><cite>CSS Color + href="http://www.w3.org/TR/2011/REC-css3-color-20110607/"><cite>CSS Color Module Level 3.</cite></a> 7 June 2011. W3C Recommendation. URL: <a - href="http://www.w3.org/TR/2011/REC-css3-color-20110607">http://www.w3.org/TR/2011/REC-css3-color-20110607</a> + href="http://www.w3.org/TR/2011/REC-css3-color-20110607/">http://www.w3.org/TR/2011/REC-css3-color-20110607/</a> </dd> <!----> </dl> @@ -746,6 +873,9 @@ <li>as conformance class, <a href="#style-sheet" title="style sheet, as conformance class"><strong>6.2.</strong></a> </ul> + + <li><a href="#variablerule"><code>VARIABLE_RULE</code></a>, <a + href="#variablerule" title="VARIABLE_RULE"><strong>4.2.1.</strong></a> </ul> <!--end-index--> Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css-variables/Overview.src.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Overview.src.html 29 Sep 2011 00:27:05 -0000 1.6 +++ Overview.src.html 30 Sep 2011 19:51:08 -0000 1.7 @@ -23,6 +23,10 @@ color: black; } </style> + <style> + pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em } + pre.idl :link, pre.idl :visited { color:inherit; background:transparent } + </style> </head> <div class="head"> @@ -192,10 +196,92 @@ <h2 id='cssom'> APIs</h2> - <p class='issue'>Define the "basic" CSSOM APIs from <a href="http://disruptive-innovations.com/zoo/cssvariables/#mozTocId847334">Daniel's and Hyatt's spec</a>.</p> + <p>CSS Variables are mutable - one can change them after they've been defined, through the CSSOM. This can be done in two ways: one can read the current variable definition and set an override definition through the convenient <code>.vars</code> property, or manipulate the definitions in the stylesheets directly through the standard CSSOM stylesheet interface.</p> + +<h3 id='cssom-simple'> +The Simple API</h3> <p class='issue'>Define the more convenient CSSOM API from <a href="http://www.xanthir.com/blog/b4AD0">my blog post</a>.</p> +<h3 id='cssom-stylesheet'> +Additions to the Stylesheet Interface</h3> + + <p>This specification extends the IDL definitions in the CSSOM spec [[!CSSOM]] in several ways.</p> + +<h4 id='cssom-cssrule'> +Changes to interface CSSRule</h4> + + <dl> + <dt>IDL Definition</dt> + <dd> + <pre class='idl'> +interface CSSRule { + + // RuleType + const unsigned short UNKNOWN_RULE = 0; + const unsigned short STYLE_RULE = 1; + const unsigned short CHARSET_RULE = 2; + const unsigned short IMPORT_RULE = 3; + const unsigned short MEDIA_RULE = 4; + const unsigned short FONT_FACE_RULE = 5; + const unsigned short PAGE_RULE = 6; + <ins>const unsigned short <code>VARIABLE_RULE</code> = 11;</ins> + readonly attribute unsigned short type; + attribute DOMString cssText; + // raises(DOMException) on setting + readonly attribute CSSStyleSheet parentStyleSheet; + readonly attribute CSSRule parentRule; +};</pre> + + <dt>Defined Constants</dt> + <dd><dfn><code>VARIABLE_RULE</code></dfn>: The rule is a <code>CSSVariableRule</code>.</dd> + </dl> + + <p class='issue'>Going with value 11 for now, since CSSOM seems to reserve 0-10.</p> + +<h4 id='cssom-cssvariablerule'> +Interface CSSVariableRule</h4> + + <p>The <code>CSSVariableRule</code> interface represents a ''@var'' rule within a CSS stylesheet. The ''@var'' rule is used to define variables.</p> + + <dl> + <dt>IDL Definition</dt> + <dd> + <pre class='idl'> +interface CSSVariableRule : CSSRule { + attribute DOMString name; + attribute DOMString value; +}</pre> + </dd> + </dl> + +<h4 id='cssom-cssvariable'> +Interface CSSVariableComponentValue</h4> + + <p>The CSSVariableComponentValue interface represents a call to a CSS Variable.</p> + + <dl> + <dt>IDL Definition</dt> + <dd> + <pre class='idl'> +[NoInterfaceObject] interface CSSVariableComponentValue { + attribute DOMString variableName; + readonly attribute any variableValue; +}</pre> + </dd> + + <dt>Attributes</dt> + <dd> + <dl> + <dt><code>variableName</code> of type <code>DOMString</code></dt> + <dd>This attribute is used for the name of the variable. Changing this attribute changes the variable being referred to.</dd> + + <dt><code>variableValue</code> of type <code>any</code>, readonly</dt> + <dd>This attribute is used for the value of the variable.</dd> + </dl> + </dd> + </dl> + <h2 id='grammar'> The Grammar of Variables</h2>
Received on Friday, 30 September 2011 19:51:17 UTC