W3C home > Mailing lists > Public > www-style@w3.org > September 2011

Re: [css3-values] syntax of attr()

From: Marat Tanalin <mtanalin@yandex.ru>
Date: Fri, 16 Sep 2011 04:28:55 +0400
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
Message-Id: <611221316132935@web2.yandex.ru>
Worthwhileness of mixing new language-level keyword into classic arguments comma-separated list is at least questionable.

It maybe make sense to consider following expanded form to _coexist_ with current shorthand:

Shorthand (classical argument list):
attr(bgcolor, color, black)

Expanded (JSON-like associative array):
  name: bgcolor,
  type: color,
  fallback: black

In shorthand form, arguments are listed in algoristic order.

In expanded form, order can be arbitrary which make this serve to be mnemonically friendly as your purpose is:

  fallback: black,
  type: color,
  name: bgcolor

16.09.2011, 03:07, "fantasai" <fantasai.lists@inkedblade.net>:
> Currently the syntax of attr() is
> attr(<ident>, <type>, <fallback>)
> e.g.
> attr(bgcolor, color, black)
> I get rather confused with positional syntaxes, because I can never remember which
> argument goes first, second, etc. So I've been pondering alternatives and came up
> with
> attr(<ident> as <type>, <fallback>)
> e.g.
> attr(bgcolor as color, black)
> which makes it less positional -- the type is more closely tied to the attribute
> name than to the fallback, and then the comma behaves to separate alternatives
> like it does in font-family.
> Thoughts?
> ~fantasai
Received on Friday, 16 September 2011 00:29:36 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:04 UTC