Re: [csswg-drafts] [css-values] Spec does not reject duplicate `<request-url-modifier>`s, but WPT does (#12151)

> Many CSS values can repeat in a stylesheet, with the last occurrence taking precedence. The only other place I can think of where repeating a value is forbidden (in prose) is @function parameter list. If url modifiers cannot repeat, this seems simpler to specify in prose, imo.

Interesting, but I don't really see it that way. I would argue just the opposite, as for most values, a part of a CSS value can't be repeated. You can't say `color(srgb srgb 1 0 1)`. That's what the grammars enforce.

I do see the issue you bring up with ordering however and I think your new grammar is good. In general, I think as little (ideally nothing) as possible should be in prose, as that makes implementations and testing more challenging.

--

Updated resolution:

Update grammar for `<url>` to disallow duplicate `<request-url-modifier>` productions by changing the grammar from:

```
<url> = <url()> | <src()>

<url()> = url( <string> <url-modifier>* ) | <url-token>
<src()> = src( <string> <url-modifier>* )
```

to

```
<url> = <url()> | <src()>

<url()> = url( <string> <url-modifiers>? ) | <url-token>
<src()> = src( <string> <url-modifiers>? )
```

and adding the definition of `<url-modifiers>` as:

 ```
<unknown-modifiers> = [ <ident> | <function-token> <any-value>? ) ]+
<url-modifiers> = <unknown-modifiers> || <request-url-modifier> || <unknown-modifiers>
<request-url-modifier> = <crossorigin-modifier> || <integrity-modifier> || <referrerpolicy-modifier>
<crossorigin-modifier> = crossorigin(anonymous | use-credentials)
<integrity-modifier> = integrity(<string>)
<referrerpolicy-modifier> = referrerpolicy(no-referrer | no-referrer-when-downgrade | same-origin | origin | strict-origin | origin-when-cross-origin | strict-origin-when-cross-origin | unsafe-url)

Additionally, some prose is needed to state:

"`<unknown-modifiers>` matches anything except values matched by `<request-url-modifier>`".
```

-- 
GitHub Notification of comment by weinig
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12151#issuecomment-3005342031 using your GitHub account


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

Received on Wednesday, 25 June 2025 16:08:10 UTC