- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 30 Sep 2011 20:31:34 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css-variables In directory hutz:/tmp/cvs-serv16067 Modified Files: Overview.html Overview.src.html Log Message: First draft of the simpler variables api. Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css-variables/Overview.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Overview.html 30 Sep 2011 19:51:44 -0000 1.8 +++ Overview.html 30 Sep 2011 20:31:32 -0000 1.9 @@ -336,8 +336,9 @@ class=css>@var</code>’ rules attempt to define variables with the same name, the last one defined wins; the preceding ‘<code class=css>@var</code>’ rules do not define a variable. For this - purpose, user-agent defined rules come before author-defined rules, which - come before user-defined rules. Within each of the preceding groups, the + purpose, user-agent defined variable rules come before author-defined + variable rules, which come before user-defined variable rules, which come + before override variable rules. Within each of the preceding groups, the ordering is document order. <div class=example> @@ -464,8 +465,46 @@ <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>. + <p class=issue>Not exactly sure how to define this, but I want to put a + ‘<code class=property>css</code>’ property on + <code>document</code> (and hopefully <code>window</code>) as a hook for + this and other future CSS apis. <code>document.css</code> would then + expose a ‘<code class=property>vars</code>’ property that + implements CSSOverrideVariablesMap. Variables are document-global, so they + need to be exposed at the document level, not the stylesheet level. + + <p class=issue>Do I need to define the concept of the override stylesheet? + Several browsers already expose this concept of a script-only stylesheet + that overrides all other stylesheets. + + <p>The CSSOverrideVariablesMap presents a simple interface to the variables + in the override stylesheet, which take precedence over variables defined + elsewhere in the document. As a convenience, it also allows reading normal + variables defined elsewhere in the document, as long as there is no + variable with the same name in the override stylesheet. + + <pre class=idl> +[NoInterfaceObject] CSSOverrideVariablesMap { + getter any (DOMString variableName); + setter void (DOMString variableName, any variableValue); + creator void (DOMString variableName, any variableValue); + deleter void (DOMString variableName); +}</pre> + + <p>On getting, if a variable named <var>variableName</var> exists in the + override stylesheet, return its value. Otherwise, if a variable named + <var>variableName</var> is defined in the document, return its value. + Otherwise, return null. + + <p>On setting, find the variable named <var>variableName</var> in the + override stylesheet and set its value to <var>variableValue</var>. + + <p>On creating, append a new variable rule to the override stylesheet, with + the variable name set to <var>variableName</var> and the value set to + <var>variableValue</var>. + + <p>On deleting, remove the variable with the name <var>variableName</var> + from the override stylesheet. <h3 id=cssom-stylesheet><span class=secno>4.2. </span> Additions to the Stylesheet Interface</h3> Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css-variables/Overview.src.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Overview.src.html 30 Sep 2011 19:51:44 -0000 1.8 +++ Overview.src.html 30 Sep 2011 20:31:32 -0000 1.9 @@ -130,7 +130,7 @@ <p>If new ''@var'' rules are added to the document through any means, such as direct CSSOM manipulation or new stylesheets being added to the document, or if an <i>inactive</i> ''@var'' rule becomes <i>active</i>, they define variables. Similarly, if ''@var'' rules are removed from the document or become <i>inactive</i>, they no longer define variables.</p> - <p>If multiple <i>active</i> ''@var'' rules attempt to define variables with the same name, the last one defined wins; the preceding ''@var'' rules do not define a variable. For this purpose, user-agent defined rules come before author-defined rules, which come before user-defined rules. Within each of the preceding groups, the ordering is document order.</p> + <p>If multiple <i>active</i> ''@var'' rules attempt to define variables with the same name, the last one defined wins; the preceding ''@var'' rules do not define a variable. For this purpose, user-agent defined variable rules come before author-defined variable rules, which come before user-defined variable rules, which come before override variable rules. Within each of the preceding groups, the ordering is document order.</p> <div class='example'> <p>Earlier declarations of the same variable have no effect, even if uses of the variable come between the earlier and final attempts to define the variable:</p> @@ -205,7 +205,27 @@ <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> + <p class='issue'>Not exactly sure how to define this, but I want to put a 'css' property on <code>document</code> (and hopefully <code>window</code>) as a hook for this and other future CSS apis. <code>document.css</code> would then expose a 'vars' property that implements CSSOverrideVariablesMap. Variables are document-global, so they need to be exposed at the document level, not the stylesheet level.</p> + + <p class='issue'>Do I need to define the concept of the override stylesheet? Several browsers already expose this concept of a script-only stylesheet that overrides all other stylesheets.</p> + + <p>The CSSOverrideVariablesMap presents a simple interface to the variables in the override stylesheet, which take precedence over variables defined elsewhere in the document. As a convenience, it also allows reading normal variables defined elsewhere in the document, as long as there is no variable with the same name in the override stylesheet.</p> + + <pre class='idl'> +[NoInterfaceObject] CSSOverrideVariablesMap { + getter any (DOMString variableName); + setter void (DOMString variableName, any variableValue); + creator void (DOMString variableName, any variableValue); + deleter void (DOMString variableName); +}</pre> + + <p>On getting, if a variable named <var>variableName</var> exists in the override stylesheet, return its value. Otherwise, if a variable named <var>variableName</var> is defined in the document, return its value. Otherwise, return null.</p> + + <p>On setting, find the variable named <var>variableName</var> in the override stylesheet and set its value to <var>variableValue</var>.</p> + + <p>On creating, append a new variable rule to the override stylesheet, with the variable name set to <var>variableName</var> and the value set to <var>variableValue</var>.</p> + + <p>On deleting, remove the variable with the name <var>variableName</var> from the override stylesheet.</p> <h3 id='cssom-stylesheet'> Additions to the Stylesheet Interface</h3>
Received on Friday, 30 September 2011 20:31:41 UTC