Re: [csswg-drafts] [css-transitions-2] Exit animations (`@exit-style`) (#9500)

> That includes the overhead of adding an event listener for `onanimationend` and then the removal / garbage collection of it afterwards. If someone chooses to use a `setTimeout` instead, they have to match their CSS's duration and keep them in sync. And with a view transition, you have to match identifiers between JS and CSS. `@exit-style` would effectively eliminate all of that extra code.

Just wanted to clarify that the View Transitions approach does not require any new event listeners. The element can be removed in the callback passed to `startViewTransition`. So for browsers that support View Transitions, it is this "one line of code" vs the "one line of code" to remove the element from the DOM via `removeChild` or similar. For this aspect, I don't see a substantial difference in amount of code developers have to write.

However, there will be a difference for the web developer when using `startViewTransition` in that the element won't be removed until after the next render, which may introduce some complexity they have to deal with due to their DOM state being briefly out of sync with any JS model state.



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


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

Received on Monday, 30 October 2023 22:22:22 UTC