Skip to content

[css-content] URL fallbacks in 'content' should require type() or format() #217

@zcorpan

Description

@zcorpan

https://drafts.csswg.org/css-content/#example-1a710936

/* Replace <logo> elements with the site’s logo, using a format
 * supported by the UA */
logo { content: url(logo.mov), url(logo.mng), url(logo.png), none; }

I think this is bad. In order for the fallback to work at all, the UA needs to fetch each resource in order and try to decode it, and stop when it has found something it can decode. This is like <video><source> when not using the type attribute, and I think it is bad both for page loading performance and for increased implementation complexity. We carefully avoided it when designing <picture>'s processing model.

If we want this to work, I think a type() or format() function (or some such) to go with each URL should be provided, so the UA can skip resources it knows it doesn't support right away. If it isn't provided, then the UA should load the given resource and if it finds it doesn't support it, it should not try to load the next item; it should skip straight to the next non-url fallback (none above).

cc @fantasai @tabatkins @yoavweiss

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions