Re: Generic fallback mechanism based on network or user agent compliance

Laurens Holst schreef:
>> Generic fallback mechanism
>> (Please discuss the idea and not the syntax itself, I am sure W3 would
>> find good ways to realise it.)
>> background: [transparent url(grayishsemitransparent.png) repeat]
>>             [gray url(grayishopaque.jpg) 50% 50% no-repeat]
>>             [gray];

On an additional note, a more elegant way to solve the problem like 
this, one might as well simply define that the fallback behaviour for 
urls is that they invalidate the property.

CSS 2.1 says: “User agents may vary in how they handle invalid URIs or 
URIs that designate unavailable or inapplicable resources”, CSS3 could 
clarify this to ‘invalid URIs or URIs that designate unavailable or 
inapplicable resources should be treated as invalid values’.

It would allow you to simply write:

background: gray;
background: gray url(grayishopaque.jpg) 50% 50% no-repeat;
background: transparent url(grayishsemitransparent.png) repeat;

It’s more compatible with existing implementations as well, they will 
simply pick the last rule and use the current suboptimal fallback 
behaviour, while your method will not be recognised, requiring the 
author to explicitly write an additional rule to support older user agents.

On the other hand, this is not entirely compatible with current 
implementations, as currently the established behaviour is to ignore 
invalid URIs and apply the other properties that are set (e.g. 
background colour). But I don’t think changing this would really harm 
existing stylesheets much except ones that point to non-existing 
resources; and besides, they were depending on undefined behaviour 
anyway, and this one is more flexible.


Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!
Laurens Holst, student, university of Utrecht, the Netherlands.
Website: Backbase employee;

Received on Monday, 8 May 2006 09:54:08 UTC