Skip to content

Commit

Permalink
Encapsualte the card in a shadow root (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr authored Oct 26, 2021
1 parent ea6db75 commit b5c03ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vertical-stack-in-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ class VerticalStackInCard extends HTMLElement {
});
}
card.appendChild(cardContent);
while (this.hasChildNodes()) {
this.removeChild(this.lastChild);

const shadowRoot = this.shadowRoot || this.attachShadow({mode: 'open'});
while (shadowRoot.hasChildNodes()) {
shadowRoot.removeChild(shadowRoot.lastChild);
}
this.appendChild(card);
shadowRoot.appendChild(card);

// Calculate card size
this._cardSize.resolve();
Expand Down

0 comments on commit b5c03ae

Please sign in to comment.