Closed Bug 1878481 Opened 2 years ago Closed 2 years ago

Parsing a CSS animation shorthand containing a variable results in the loss of the animation name.

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 122
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: thomas.benhamou, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

Wrote two javascript codes:

I have written two JavaScript codes to illustrate the problem:

Code 1:

a = new CSSStyleSheet()
str = (.test { animation: test; animation-delay: 5s; })
a.replaceSync(str)
console.log(a.cssRules[0].cssText)

Code 2:

a = new CSSStyleSheet()
str = (.test { animation: var(--test); animation-delay: 5s; })
a.replaceSync(str)
console.log(a.cssRules[0].cssText)

Actual results:

Code 1; Correct behaviour
".test { animation: 0s ease 5s 1 normal none running test; }"

Code 2; Animation name is lost
".test { animation-name: ; animation-duration: ; animation-timing-function: ; animation-iteration-count: ; animation-direction: ; animation-fill-mode: ; animation-play-state: ; animation-delay: 5s; }"

Expected results:

In Code 2, I expect the animation name to be preserved in the CSS output. Ideally, the result should be:

".test { animation: 0s ease 5s 1 normal none running var(--test); }"
OR

".test { animation-name: ; animation-duration: ; animation-timing-function: ; animation-iteration-count: ; animation-direction: ; animation-fill-mode: ; animation-play-state: ; animation-delay: 5s; }"

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

That wouldn't be correct because we don't know what var(--test) contains. In fact, it could contain all of the tokens (also a duration etc).

See also https://github.com/w3c/csswg-drafts/issues/6253

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.