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

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):
attr(
  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:

attr(
  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