Skip to content

Commit

Permalink
Use ShadyDOM.upgrade
Browse files Browse the repository at this point in the history
This is a more optimized way to create and populate a `shadowRoot`.
  • Loading branch information
Steven Orvell committed Feb 14, 2019
1 parent 1302641 commit 50ba9ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,13 @@ export const ElementMixin = dedupingMixin(base => {
if (n.attachShadow) {
if (dom) {
if (!n.shadowRoot) {
n.attachShadow({mode: 'open'});
if (window.ShadyDOM) {
ShadyDOM.upgrade(dom, this, {mode: 'open'});
} else {
n.attachShadow({mode: 'open'});
n.shadowRoot.appendChild(dom);
}
}
n.shadowRoot.appendChild(dom);
if (syncInitialRender && window.ShadyDOM) {
ShadyDOM.flushInitial(n.shadowRoot);
}
Expand Down

0 comments on commit 50ba9ce

Please sign in to comment.