This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* cloneNode(true), but also clones shadow roots. | |
* @param {Element} | |
* @param {ShadowRoot[]} [shadowRoots] Any closed shadow roots passed here will be included. | |
*/ | |
function cloneWithShadowRoots(node, shadowRoots = []) { | |
function walk(node, clone) { | |
let shadow = node.shadowRoot || shadowRoots.find(r => r.host === node); | |
if (shadow) { | |
(clone.shadowRoot || clone.attachShadow({ mode: shadow.mode })).append(...[].map.call(shadow.childNodes, c => c.cloneNode(true))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const map = [ | |
"****", | |
"*..*", | |
"**.*", | |
"****", | |
"**.*", | |
"**.*", | |
"*.**", | |
"****" | |
]; |