Skip to content

Commit

Permalink
Cleanup inline styles on update
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Jan 28, 2024
1 parent 50149f3 commit 65243fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ export class CSSDoodle extends HTMLElement {

cleanup() {
Cache.clear();
for (let animation of this.animations) {
animation.cancel();
if (this.compiled) {
for (let animation of this.animations) {
animation.cancel();
}
this.animations = [];
let { pattern, shaders } = this.compiled;
if (Object.keys(pattern).length || Object.keys(shaders).length) {
for (let el of this.shadowRoot.querySelectorAll('cell')) {
el.style.cssText = '';
}
}
}
this.animations = [];
}

update(styles) {
Expand Down

0 comments on commit 65243fc

Please sign in to comment.