W3C home > Mailing lists > Public > www-style@w3.org > May 2012

Re: [css-background] Order of properties in background shorthand

From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 31 May 2012 11:43:18 -0700
To: Joe Thomas <joethomas@motorola.com>
Cc: www-style@w3.org
Message-ID: <20120531184318.GA22901@crum.dbaron.org>
On Wednesday 2012-05-23 21:14 +0000, Joe Thomas wrote:
> I would like to discuss about the order of CSS properties in background
> shorthand.
> A bit about the context:
> Currently getComputedStyle of background shorthand property in webkit does
> not return the three properties newly added to the background shorthand in
> CSS3 namely background-size, background-origin and background-clip. We are
> in the process of adding support for these three properties in
> getComputedStyle as part of https://bugs.webkit.org/show_bug.cgi?id=86155
> The order of  the properties in background shorthand as per CSS3
> specification http://www.w3.org/TR/css3-background/#the-background is
>  <bg-image> || <bg-position> [ / <bg-size> ]? || <bg-repeat> ||
> <bg-attachment> || <box>{1,2} || <bg-color>

The only ordering constraint here is that the optional
background-size part has to come right after the background-position

> The above order is different from the order mentioned in CSS2.1
> specification http://www.w3.org/TR/CSS21/colors.html#background-propertiesfor
> the same properties, which is  <bg-color> || <bg-image> || <bg-repeat>
> || <bg-attachment> || <bg-position>

There's no difference here.  || implies that one or more of the
alternatives can occur, in any order, as described in

If what you're talking about is serialization, then serialization
order isn't defined other than that it must be minimal per:
  # When dealing with CSS "shorthand" properties, the shorthand
  # properties should be decomposed into their component longhand
  # properties as appropriate, and when querying for their value,
  # the form returned should be the shortest form exactly equivalent
  # to the declarations made in the ruleset. However, if there is no
  # shorthand declaration that could be added to the ruleset without
  # changing in any way the rules already declared in the ruleset
  # (i.e., by adding longhand rules that were previously not
  # declared in the ruleset), then the empty string should be
  # returned for the shorthand property.
except in the newest specs that have a "Canonical order:" line in
the property template.

(Yes, I'm aware that the editor of [cssom] has proposed otherwise in
the editor's draft at
http://dev.w3.org/csswg/cssom/#serializing-css-values , but I think
there was opposition to that from the group (since the "Value:"
lines weren't intended for that use), which led to the introduction
of the "Canonical order:" line in the property templates.)


𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Thursday, 31 May 2012 18:43:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:35:10 UTC