Skip to content

[css-animations] animation-name can contain string #3296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ewilligers
Copy link
Contributor

The computed value for animation-name can contain strings.

For example, the following are valid:
@Keyframes "initial" { ... }
@Keyframes "None" { ... }

The computed value for animation-name
"initial", "None", None
should be
"initial", "None", none

Without quotes, the computed value would not round trip.

The computed value for animation-name can contain strings.

For example, the following are valid:
@Keyframes "initial" { ... }
@Keyframes "None" { ... }

The computed value for animation-name
  `"initial", "None", None`
should be
  `"initial", "None", none`

Without qotes, the computed value would not round trip.
@ewilligers
Copy link
Contributor Author

Proposed WPT

@tabatkins
Copy link
Member

Hm. I guess the question is; do we actually preserve this information in the underlying value? An alternative is to always make it an identifier, but serialize as a string when it's the handful of disallowed idents.

I don't have a strong opinion; I'm fine with matching implementations.

@emilio
Copy link
Collaborator

emilio commented Nov 7, 2018

See #2435

@tabatkins
Copy link
Member

Cool, so that suggests that we should keep the computed value as idents, and just specify that serialization produces strings in a few limited cases.

@birtles
Copy link
Contributor

birtles commented Nov 12, 2018

@ericwilligers I think this PR is no longer correct. If I understand the resolution from #2435 correctly, we no longer want to allow "initial" as an animation-name, for example.

From what I understand, it sounds like the behavior we want is:

  1. Accept <string> or <custom-ident> as we currently do.
  2. If <string> is one of the CSS-wide keywords or "default" then it is invalid (at parse / variable-resolution time) as per the rules for custom-idents: https://www.w3.org/TR/css-values-3/#custom-idents
  3. When serializing, if the value doesn't have whitespace(??) serialize without quotes (i.e. as <custom-ident>), otherwise serialize as <string>. I'm not sure what other cases require quotes or if there is machinery defining this somewhere else? (I looked in CSS Fonts 4 but didn't find anything there.)

@ewilligers
Copy link
Contributor Author

I missed #2435

RESOLVED: serialize all keyframes as identifiers

This implies we never serialize as strings, so "1" and " " and "initial" and "None" can not be valid keyframe names. I suspect " hello " should either not be a valid keyframe name, or it should serialize as hello.

This PR can be discarded.

@birtles
Copy link
Contributor

birtles commented Nov 12, 2018

This implies we never serialize as strings

I believe that resolution doesn't capture what was actually discussed. Or at least, when I re-read through the minutes my understanding was that we would still serialize as strings when needed. Tab's comment above also seems to suggest that.

@birtles
Copy link
Contributor

birtles commented Nov 12, 2018

3. When serializing, if the value doesn't have whitespace(??) serialize without quotes (i.e. as <custom-ident>), otherwise serialize as <string>. I'm not sure what other cases require quotes or if there is machinery defining this somewhere else? (I looked in CSS Fonts 4 but didn't find anything there.)

Maybe it would just be better to say that anything that can be serialized as a <custom-ident> is serialized as such, and anything else is serialized as a string.

@birtles birtles removed their request for review December 5, 2018 14:41
@birtles
Copy link
Contributor

birtles commented Dec 5, 2018

Cancelling review request as per my comments above, I believe this PR doesn't capture the changes discussed in the minutes.

@ewilligers
Copy link
Contributor Author

Maybe it would just be better to say that anything that can be serialized as a <custom-ident> is serialized as such, and anything else is serialized as a string.

https://jsfiddle.net/ericwilligers/5na1Ldpb/ shows that Firefox computes "Default" "Initial" "None" as Default Initial None; two of these do not round trip and Default should not round trip either.

@ewilligers ewilligers closed this Dec 10, 2018
@ewilligers
Copy link
Contributor Author

Note also that Firefox preserves '""' as a specified value, but gives none as the computed value.

@upsuper
Copy link
Member

upsuper commented Dec 11, 2018

Note also that Firefox preserves '""' as a specified value, but gives none as the computed value.

IIRC this is a known bug of Firefox.

@yisibl
Copy link
Contributor

yisibl commented Feb 12, 2025

Note also that Firefox preserves '""' as a specified value, but gives none as the computed value.

IIRC this is a known bug of Firefox.

https://bugzilla.mozilla.org/show_bug.cgi?id=1554737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-animations-1 Current Work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants