Skip to content

[css-values-3] serialization of fragment URLs in image properties #3195

Closed
@heycam

Description

@heycam

https://drafts.csswg.org/css-values-3/#local-urls

Should properties that take <url>s as images serialize fragment URLs as just the fragment or as the full, resolved URL? The spec doesn't make any distinction between <url>s for images and non-images (such as various SVG properties like marker-start). The fragment URL concept was introduced to make it easier to use local references for non-image properties when the base value might change, and local URLs don't really make sense for images.

Test: https://mcc.id.au/2018/10/url-fragment-serialize.html

Results
background-imagemask-imagefiltermarker-start
specifiedcomputedspecifiedcomputedspecifiedcomputedspecifiedcomputed
Chromeurl("#x")url("https://mcc.id.au/2018/10/url-fragment-serialize.html#x")url("#x")url("#x")url("#x")url("#x")
Edgeurl("#x")url(https://mcc.id.au/2018/10/url-fragment-serialize.html#x)url(#x)noneurl("#x")url("#x")
Firefoxurl("#x")url("https://mcc.id.au/2018/10/url-fragment-serialize.html#x")url("#x")url("https://mcc.id.au/2018/10/url-fragment-serialize.html#x")url("#x")url("#x")url("#x")url("#x")
Safariurl("https://mcc.id.au/2018/10/url-fragment-serialize.html#x")url("https://mcc.id.au/2018/10/url-fragment-serialize.html#x")url("#x")url("#x")url("#x")url("x")

 

All four browsers I tested serialize the computed value of background-image with a fragment as the entire resolved URL. (Safari is an odd one out in serializing the entire resolved URL for the specified value, too. And there's a bug in the marker-start computed value serialization.)

I think it makes sense to treat image and non-image <url> values the same way wrt fragment URLs, but since nobody implements this behavior I wanted to check to make sure it's what we all agree with before changing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions