Closed Bug 1872231 Opened 9 months ago Closed 9 months ago

animate API does not work with custom property

Categories

(Core :: DOM: Animation, defect)

Firefox 122
defect

Tracking

()

RESOLVED DUPLICATE of bug 1846516

People

(Reporter: cyfung1031, Unassigned)

References

()

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Steps to reproduce:

(note. layout.css.properties-and-values.enabled is enabled)

  1. define CSS custom property --num using CSS
@property --num {
  syntax: "<integer>";
  initial-value: 3;
  inherits: false;
}
  1. Check using JavaScript
    Now window.getComputedStyle(document.documentElement).getPropertyValue('--num'); is 3

  2. Use animate API to modify the CSS value

document.documentElement.animate(
  [
    { '--num': '100' },
    { '--num': '0' }
  ],
  {
    fill: "forwards",
    duration: 1000*30,
    easing: 'linear'
  }
);
  1. Check using JavaScript (immediately after animate API is called)
    window.getComputedStyle(document.documentElement).getPropertyValue('--num'); is still 3. The correct value should be 100 (see Chrome)

Demo: https://jsfiddle.net/lunarlogic489/kx8joawb/2/

Actual results:

animate API does not work with custom property

Expected results:

animate API should work with custom property

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

(In reply to BugBot [:suhaib / :marco/ :calixte] from comment #1)

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.

I am not sure

Either
Core :: CSS Transitions and Animations
OR
Core :: CSS Parsing and Computation

Component: CSS Parsing and Computation → CSS Transitions and Animations
Component: CSS Transitions and Animations → DOM: Animation

Actually this seems to work in Nightly.

Status: UNCONFIRMED → RESOLVED
Closed: 9 months ago
Duplicate of bug: 1846516
Resolution: --- → DUPLICATE
No longer blocks: css-properties-values-api

(In reply to Tom S [:evilpie] from comment #3)

Actually this seems to work in Nightly.

*** This bug has been marked as a duplicate of bug 1846516 ***

Confirm it can work in Firefox Nightly 123.0a1 (2023-12-30) (64-bit)
(I just tested in Firefox Stable and Firefox Developer Edition before)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: