Skip to content

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

@Crissov

Description

@Crissov

The specification introduces the param() function from the link-parameters property also inside url() as a modifier because the URL inside that cannot be altered to contain a parameter fragment identifier. However, with src() and string() from #542, this would be possible.

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

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