Re: [csswg-drafts] [css-animations] Clarify whether `<keyframes-name>` supports the empty string (#7762)

Hi Daniel,

> 
> **Here's a testcase to exercise this behavior**: https://bug1998933.bmoattachments.org/attachment.cgi?id=9526306
> 
> That testcase has a CSS rule in a `<style>` block to set `animation-name` to 'someStringValue', and then we use script to try setting `animation-name` in the inline style attribute, just as the WPT does:
> 
> ```
> testDiv.style.animationName = '""';
> ```
> 
> If any browser fully rejected that value as invalid-at-parse-time (as you're saying they do), then we would expect that the testcase would still report 'someStringValue' as the final computed style. (This is indeed what happens in Chrome 143.)
> 
> But neither Firefox, Safari, nor **Chrome 144 Canary** do that -- they all change the computed style (to `none` in Firefox and Chrome canary, and to the empty string in Safari).
> 

Yeah, I check it again and you are right. I had implemented the logic to make the empty string as invalid, but forgot to integrate it because the test was already passing. That's a sing, as you suggested, that we need more-thorough tests for that case.


> > It seems that Firefox accepts `'""'` as a valid `<string>` value, when it shouldn't as agreed here by Tab and Fantasai.
> 
> Not quite. As shown in my testcase:
> 
>     * That^ description (accepting `'""'` as a valid `<string>` value) seems to match what **Safari** does -- they accept the empty string and even use it as the computed value for animation-name.
> 
>     * Chrome also accepts the empty string, and serialize to the empty string, but treat it as `none` by computed-value time.
> 
>     * Firefox accepts the empty string and internally treats it as `none` at parse time (because we literally encode the special `none` value as the empty-string, see [here](https://searchfox.org/firefox-main/rev/4fd0fa7e5814c0b51f1dd075821988377bc56cc1/servo/components/style/values/mod.rs#691-693) in the definition of `KeyframesName` which is the underlying type here.

I don't understand well what do you mean with "because we literally encode the special `none` value as the empty-string"; 'none' is a valid ident for the ```css-animation-name``` property, which its serialized as such returning 'none' for both the specified and computed value. 

> 
> 
> So, I propose:
> 
>     * we need to adjust `animation-name-computed.html` to not treat `'""'` as invalid, since (for now at least) all the major browsers **do treat it as a parsable value**.

I agree, but if we reach an agreement soon, perhaps it's not worth to change those tests. I agree that we should add more, and the ones suggested in the previous comment could be good candidates.

> 
>     * but we need to decide how it should be handled (at parse time and computed-value time)

I agree as well, although Tab and Fantasai already expressed opinions to consider it invalid (at parse time, I assume). As such, it wouldn't have any computed value.  

That would cover Chrome and Safari's position I guess. Would you agree on behalf of Firefox or do you think we should discuss it again ? 


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


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

Received on Wednesday, 19 November 2025 12:59:01 UTC