Skip to content

Commit

Permalink
Defensive when no shadowroot #13
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 12, 2022
1 parent e19a32b commit 070dd57
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions is-land.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ class Island extends HTMLElement {
if(!shadowroot) {
// polyfill
let tmpl = node.querySelector(":scope > template[shadowroot]");
shadowroot = node.attachShadow({ mode: "open" });
shadowroot.appendChild(tmpl.content.cloneNode(true));
if(tmpl) {
shadowroot = node.attachShadow({ mode: "open" });
shadowroot.appendChild(tmpl.content.cloneNode(true));
}
}
// cheers to https://gist.github.com/developit/45c85e9be01e8c3f1a0ec073d600d01e
if(shadowroot) {
Expand Down

0 comments on commit 070dd57

Please sign in to comment.