-
Notifications
You must be signed in to change notification settings - Fork 716
[cssom] Proposal: CSS.assign #4486
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
Comments
But setting multiple properties never causes multiple repaints, unless you read in between. So I think this is WONTFIX as in it works as you want already. |
Doesn't this happen already? AFAIK, unless you force it, styles are not applied synchronously. For example, if I go to https://drafts.csswg.org/cssom/ and run for (let i = 0; i < 100; ++i) {
document.body.style.width = Math.random() * 1000 + "px";
document.body.offsetLeft;
} it takes like 8 seconds, because I'm forcing layout at each iteration. But if I remove the |
Yes, @Loirooriol articulated better what I wanted to say :) Closing unless there's something we're missing. |
I can't believe I've never measured this, but I remember (long time ago) using a single I kinda thought the reason was because of mutations, in terms of resizing, but of course I was wrong. Thanks a lot for the quick come back, and apologies for my ignorance in this regard. |
Uh oh!
There was an error while loading. Please reload this page.
It would be lovely to have the ability to define multiple CSS properties at once, without causing reflows or repaint during each property that might trigger those.
example
implementation
The
CSS.assign(style, ...objects)
would mimic 100% Object.assign but it would grant that all properties are set at once, making multiple re-style, or updates, faster than ever.The polyfill for this proposal would look something like this:
Thanks for considering this proposal.
The text was updated successfully, but these errors were encountered: