diff options
author | Alex Yatskov <alex@foosoft.net> | 2020-05-22 17:46:16 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2020-05-22 17:46:16 -0700 |
commit | 1480288561cb8b9fb87ad711d970c548329fea98 (patch) | |
tree | 87c2247f6d144407afcc6de316bbacc264582248 /test/data/html/test-document2-script.js | |
parent | f2186c51e4ef219d158735d30a32bbf3e49c4e1a (diff) | |
parent | d0dcff765f740bf6f0f6523b09cb8b21eb85cd93 (diff) |
Merge branch 'master' into testing
Diffstat (limited to 'test/data/html/test-document2-script.js')
-rw-r--r-- | test/data/html/test-document2-script.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/data/html/test-document2-script.js b/test/data/html/test-document2-script.js index bd5a570d..ab516a4e 100644 --- a/test/data/html/test-document2-script.js +++ b/test/data/html/test-document2-script.js @@ -39,3 +39,27 @@ function toggleFullscreen(element) { requestFullscreen(element); } } + +function setup(container, fullscreenElement=null) { + const fullscreenLink = container.querySelector('.fullscreen-link'); + if (fullscreenLink !== null) { + if (fullscreenElement === null) { + fullscreenElement = container.querySelector('.fullscreen-element'); + } + fullscreenLink.addEventListener('click', (e) => { + toggleFullscreen(fullscreenElement); + e.preventDefault(); + return false; + }, false); + } + + const template = container.querySelector('template'); + const templateContentContainer = container.querySelector('.template-content-container'); + if (template !== null && templateContentContainer !== null) { + const mode = container.dataset.shadowMode; + const shadow = templateContentContainer.attachShadow({mode}); + const content = document.importNode(template.content, true); + setup(content); + shadow.appendChild(content); + } +} |