-
Notifications
You must be signed in to change notification settings - Fork 4
/
x-poly.js
23 lines (19 loc) · 984 Bytes
/
x-poly.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export default async function () {
if ('shadowRoot' in HTMLTemplateElement.prototype === false) {
(function attachShadowRoots (root) {
const templates = root.querySelectorAll('template[shadowroot]');
for (const template of templates) {
const mode = (template.getAttribute('shadowroot') || 'closed');
const shadowRoot = (template.parentNode).attachShadow({ mode });
shadowRoot.appendChild(template.content);
template.remove();
attachShadowRoots(shadowRoot);
}
})(document);
}
if ('navigation' in window === false) {
// requires the following import map
//<script type="importmap">{"imports":{"abort-controller":"https://cdn.skypack.dev/abort-controller","uuid":"https://cdn.skypack.dev/uuid"}}</script>
window.navigation = new (await import('https://cdn.skypack.dev/@virtualstate/navigation')).Navigation;
}
}