css-paint-polyfill icon indicating copy to clipboard operation
css-paint-polyfill copied to clipboard

Old properties are not being removed under specific circumstances

Open jespertheend opened this issue 2 years ago • 0 comments

Here's a reduced test case. And here's the source code.

Basically, after changing an element's background using el.style.backgroundImage =, the inline css of [data-css-paint="1"] does not remove the property, even though it should.

Some things to note regarding the reduced test case:

  • The style sheet has to be <link>ed, using inline style sheets doesn't cause this issue.
  • The element has to have two separate classes for background and mask, combining these properties in a single class doesn't trigger the issue.
  • el.style.backgroundImage = has to be called asynchronously.

A workaround for the issue could be to force the background style using !important. Note that you'll need to set the property twice, once with and once without !important, it seems setting properties with !important is not supported on Chrome.

jespertheend avatar Nov 30 '21 17:11 jespertheend