Re: 关于css variable草案的一点感想

(12/03/09 20:19), John Hax wrote:
> 不过现有的草案也有缺点。最大的问题是CSS的内置处理函数太弱,只有calc(),
> 或者属性特定的复合函数比如linear-gradient之类的。

糾正一下,與其說是「屬性特定」的函數,應該說是「型態特定」(接受
<image>[1] 的屬性都行)才是。(當然屬性接受什麼型態也可以說是屬性特定,
不糾結用詞了。)


補充有的沒有的一些 www-style 討論的連結:

> 这很大程度上限制了css变量的用途。比方说缺乏像darken()这样的函数。

《in-between values》[2](例:mid(<color>, black, 0.8))

> 另外因为没有mixin机制,

《CSS Mixins proposal》[3]

> 也没有条件分支,

不是很有關係的:css3-conditional[4]

> 甚至也缺乏字符串处理函数

css3-gcpm 有 string-set() 和 string()[5]

> 或者简单的值分割函数,所以很难基于变量做到抽象复用。由此看来,css
> variable要变成一个非常有价值的工具,可能仍待时日啊。


(引用一句話

"... what the CSS WG most needs right now as far as I can see is not
blue-sky ideas; there are plenty of those floating around. What's needed
is firming up the basis for the existing specifications (e.g. doing
something about the underdefined mess that is the CSS 2.1 box model),
the way HTML5 actually specified things that HTML4 "specified".  Also
writing tests.  Lots of tests. " ~ Boris Zbarsky[6]

(我認為 CSS 工作組現在最需要的不是過度新穎的想法 — 已經有一大堆在那裡
了。CSS 工作組需要的是穩固現有規範的基礎(例:給 CSS 2.1 盒模型各種未定
義混亂造成的問題想點辦法),也就是跟 HTML5 定義 HTML4「定義」*的東西方法
一樣。另外就是寫測試資料。很多很多的測試資料。

譯註:實作者一般都不把 HTML4 當作規範看待,因為各種定義完全不清楚。)

)


[1] (未完成,歡迎參加) http://www.w3.org/html/ig/zh/wiki/Css3-images#image
[2] http://lists.w3.org/Archives/Public/www-style/2011Jan/thread#msg434
[3] http://lists.w3.org/Archives/Public/www-style/2011Mar/thread#msg478
[4] http://dev.w3.org/csswg/css3-conditional/
[5] http://dev.w3.org/csswg/css3-gcpm/#named-strings
[6]
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-March/030959.html


此致

Kenny

Received on Sunday, 25 March 2012 22:07:17 UTC