- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 30 Sep 2011 19:51:46 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css-variables
In directory hutz:/tmp/cvs-serv8437
Modified Files:
Overview.html Overview.src.html
Log Message:
Added some explanatory notes to answer questions. These will be removed before WD publication.
Index: Overview.html
===================================================================
RCS file: /sources/public/csswg/css-variables/Overview.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Overview.html 30 Sep 2011 19:51:08 -0000 1.7
+++ Overview.html 30 Sep 2011 19:51:44 -0000 1.8
@@ -268,6 +268,12 @@
<p>
+ <p class=note>I chose the $ prefix over the var() function for terseness.
+ We should try to avoid nesting functions as much as reasonable, as it's
+ hard to read. The $ is required in the variable definition as well as the
+ variable use for consistency - every instance of the variable name within
+ CSS has the same form.
+
<div class=example>
<p>This variables declaration:</p>
@@ -297,6 +303,14 @@
imported within scoped stylesheets are only available within the scoped
stylesheet and any imported stylesheets.
+ <p class=note>Making all variables global is the simplest solution that
+ works, and is consistent with other at-rules that define names, like
+ @font-face and @counter-style - the web seems to get by great on "ad-hoc
+ scoping" via adding short prefixes. If it is shown that we need a more
+ complex scoping solution in the future, I believe we can do so via a
+ general scoping/namespacing mechanism that applies to all the at-rules
+ that define names.
+
<p>A ‘<code class=css>@var</code>’ rule is <dfn
id=inactive-var-rule>inactive</dfn> if it's present in a disabled or
alternate stylesheet, a stylesheet with a media query that evaluates to
Index: Overview.src.html
===================================================================
RCS file: /sources/public/csswg/css-variables/Overview.src.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Overview.src.html 30 Sep 2011 19:51:08 -0000 1.7
+++ Overview.src.html 30 Sep 2011 19:51:44 -0000 1.8
@@ -108,6 +108,8 @@
<p>A ''@var'' rule defines a variable and assigns a value to it. It consists of the at-keyword ''@var'' followed by a variable name (an identifier starting with the "$" character), followed by the value and finally terminated with a semi-colon. The result of this rule is that the given value is assigned to the given variable name.<p>
+ <p class='note'>I chose the $ prefix over the var() function for terseness. We should try to avoid nesting functions as much as reasonable, as it's hard to read. The $ is required in the variable definition as well as the variable use for consistency - every instance of the variable name within CSS has the same form.</p>
+
<div class=example>
<p>This variables declaration:</p>
@@ -122,6 +124,8 @@
<p>Defined variables are available to all stylesheets in the document. Thus, using ''@import'' to include a stylesheet also includes all variables defined in the stylesheet (and makes all variables declared outside available within the stylesheet, if applicable). ''@var'' rules present in disabled or alternate stylesheets do not define variables. Scoped stylesheets are an exception to this: variables defined in the global scope are available within a scoped stylesheet, but variables defined or imported within scoped stylesheets are only available within the scoped stylesheet and any imported stylesheets.</p>
+ <p class='note'>Making all variables global is the simplest solution that works, and is consistent with other at-rules that define names, like @font-face and @counter-style - the web seems to get by great on "ad-hoc scoping" via adding short prefixes. If it is shown that we need a more complex scoping solution in the future, I believe we can do so via a general scoping/namespacing mechanism that applies to all the at-rules that define names.</p>
+
<p>A ''@var'' rule is <dfn id='inactive-var-rule'>inactive</dfn> if it's present in a disabled or alternate stylesheet, a stylesheet with a media query that evaluates to false, or is present within a conditional rule group [[CSS3CONDITIONAL]] whose condition evaluates to false. <i>Inactive</i> ''@var'' rules do not define variables. All other ''@var'' rules are <dfn id='active-var-rule'>active</dfn>.</p>
<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>
Received on Friday, 30 September 2011 19:51:48 UTC