|
@@ -1665,7 +1665,7 @@ toggle.addEventListener('click', (e) => {
|
|
|
|
|
|
<div class="demo-container">
|
|
<div class="demo-container">
|
|
|
|
|
|
- <div class="demo" id="demo-414e06a48e755bf9e43e5e2596f9ea7a"></div>
|
|
|
|
|
|
+ <div class="demo" id="js-demo-414e06a48e755bf9e43e5e2596f9ea7a"></div>
|
|
|
|
|
|
|
|
|
|
<template id="template-414e06a48e755bf9e43e5e2596f9ea7a">
|
|
<template id="template-414e06a48e755bf9e43e5e2596f9ea7a">
|
|
@@ -1699,16 +1699,16 @@ toggle.addEventListener('click', (e) => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
</template>
|
|
</template>
|
|
- <button data-launch="demo-414e06a48e755bf9e43e5e2596f9ea7a">Launch in separate window</button>
|
|
|
|
|
|
+ <button data-launch="js-demo-414e06a48e755bf9e43e5e2596f9ea7a">Launch in separate window</button>
|
|
<script>
|
|
<script>
|
|
(function() {
|
|
(function() {
|
|
- var root = document.getElementById('demo-414e06a48e755bf9e43e5e2596f9ea7a');
|
|
|
|
|
|
+ var root = document.getElementById('js-demo-414e06a48e755bf9e43e5e2596f9ea7a');
|
|
var template = document.getElementById('template-414e06a48e755bf9e43e5e2596f9ea7a');
|
|
var template = document.getElementById('template-414e06a48e755bf9e43e5e2596f9ea7a');
|
|
var script = template.content.querySelector('script');
|
|
var script = template.content.querySelector('script');
|
|
|
|
|
|
if (script) {
|
|
if (script) {
|
|
- var standaloneScript = '(function() { var demo = document; ' + script.textContent + ' })()';
|
|
|
|
- var wrappedScript = '(function() { var demo = document.getElementById(\'demo-414e06a48e755bf9e43e5e2596f9ea7a\').shadowRoot;' + script.textContent + '})()';
|
|
|
|
|
|
+ var standaloneScript = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + script.textContent + ' })()';
|
|
|
|
+ var wrappedScript = '(function() { var demo = document.getElementById(\'js-demo-414e06a48e755bf9e43e5e2596f9ea7a\').shadowRoot;' + script.textContent + '})()';
|
|
script.textContent = wrappedScript;
|
|
script.textContent = wrappedScript;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1716,17 +1716,16 @@ toggle.addEventListener('click', (e) => {
|
|
root.attachShadow({mode: 'open'});
|
|
root.attachShadow({mode: 'open'});
|
|
root.shadowRoot.appendChild(document.importNode(template.content, true));
|
|
root.shadowRoot.appendChild(document.importNode(template.content, true));
|
|
} else {
|
|
} else {
|
|
- root.innerHTML = '<p class="site-error"><strong style="font-weight:bold">Site error:</strong> A browser supporting Shadow DOM is needed to run encapsulated demos. The browser does not have an issue with the demo code itself.</p>';
|
|
|
|
|
|
+ root.innerHTML = '<p class="site-error"><strong style="font-weight:bold">Site error:</strong> A browser supporting Shadow DOM is needed to run encapsulated demos. You can launch the demo in a separate window ↓</p>';
|
|
}
|
|
}
|
|
|
|
|
|
- var launchButton = document.querySelector('[data-launch="demo-414e06a48e755bf9e43e5e2596f9ea7a"]');
|
|
|
|
|
|
+ var launchButton = document.querySelector('[data-launch="js-demo-414e06a48e755bf9e43e5e2596f9ea7a"]');
|
|
launchButton.addEventListener('click', function () {
|
|
launchButton.addEventListener('click', function () {
|
|
-
|
|
|
|
var demoContent = template.content;
|
|
var demoContent = template.content;
|
|
var standalone = window.open();
|
|
var standalone = window.open();
|
|
-
|
|
|
|
script.textContent = standaloneScript;
|
|
script.textContent = standaloneScript;
|
|
standalone.document.body.appendChild(document.importNode(template.content, true));
|
|
standalone.document.body.appendChild(document.importNode(template.content, true));
|
|
|
|
+ standalone.document.title = 'demo' + "414e06a48e755bf9e43e5e2596f9ea7a"
|
|
});
|
|
});
|
|
})();
|
|
})();
|
|
</script>
|
|
</script>
|