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

[css-background] Order of properties in background shorthand

From: Joe Thomas <joethomas@motorola.com>
Date: Wed, 23 May 2012 21:14:46 +0000
Message-ID: <CAETFwdCYy-i=7wrscJnSZx=ueZVHjky6AKw101BH_4j-nsnBVA@mail.gmail.com>
To: www-style@w3.org

I would like to discuss about the order of CSS properties in background

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

If the UAs started generating background shorthand property as per CSS3
spec, that makes it harder for older UAs that supports only CSS2.1 spec
(like IE6) to parse these generated results. Also from my testing, I
observed that IE6 fails to parse the background shorthand if the order is
mentioned as per CSS3 spec. On the other hand if the order of properties in
background shorthand gets changed to CSS2.1 order followed by three
properties newly introduced in CSS3, older UAs like IE6 can parse all the
properties mentioned in CSS2.1 correctly and it ignores the new properties
which are added at the end. This will help us to maintain backward
compatibility. Latest Opera Browser (v 11.64) generates background
shorthand value in getComputedStyle in this order. So the below order will
be helpful in maintaining backward compatibility with older UAs

<bg-color> || <bg-image> || || <bg-repeat> || <bg-attachment>
|| <bg-position> [ / <bg-size> ]? <box>{1,2}

Could you please let us know your thoughts on this?

Joe Thomas
Received on Thursday, 31 May 2012 18:10:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:17 UTC