[csswg-drafts] [css-link-params] `url(param())` vs. `src(string())` (#12499)

Crissov has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-link-params] `url(param())` vs. `src(string())` ==
The [specification](https://drafts.csswg.org/css-link-params/#setting-url) introduces the `param()` function from the [`link-parameters` property](https://drafts.csswg.org/css-link-params/#link-param-prop) also inside `url()` as a modifier because the URL inside that cannot be altered to contain a [parameter fragment identifier](https://drafts.csswg.org/css-link-params/#setting-url). However, with `src()` and `string()` from #542, this would be possible. 

~~~~ css
:root {
--primary-color: green;
}
.property {
  background-image: url("image.svg");
  link-parameters: param(--color, var(--primary-color));
}
.fragment { /* static */
  background-image: url("image.svg#param(--color, green)");
}
.url {
  background-image: url("image.svg"
    param(--color, var(--primary-color))
  );
}
.src {
  background-image: src(string("image.svg#param(--color," var(--primary-color) ")"
  );
}
~~~~

Do we really need all those different ways? Should string concatenation replace the URL modifier variant in 2.3?

I also don’t quite see why a special function, i.e. `param()`, would be required for the property variant in 2.1. `link-parameter` (should be singular) could just take a comma separated list of pairs of a dashed ident and a value. That value cannot contain a comma itself anyway.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12499 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 18 July 2025 12:22:12 UTC