Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Commit 16ade32

Browse files
authored
Support shady flag without =true (#84)
1 parent 9caeb5d commit 16ade32

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/renderer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class Renderer {
5555
// serialize the page.
5656
// TODO(samli): This needs to change to use the non-deprecated API after Chrome 61
5757
// addScriptToEvaluateOnNewDocument({source: `ShadyDOM = {force: true}`})
58-
if (!!options['wc-inject-shadydom']) {
58+
const shadyFlag = options['wc-inject-shadydom'];
59+
if (shadyFlag == '' || !!shadyFlag) {
5960
// Deprecated in Chrome 61.
6061
Page.addScriptToEvaluateOnLoad({scriptSource: `customElements.forcePolyfill = true`});
6162
Page.addScriptToEvaluateOnLoad({scriptSource: `ShadyDOM = {force: true}`});

test/app-test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ test('renders shadow DOM - polyfill loader', async(t) => {
8080
t.true(res.text.indexOf('shadow-root-text') != -1);
8181
});
8282

83+
test('renders shadow DOM - polyfill loader - different flag', async(t) => {
84+
const server = await createServer();
85+
const res = await server.get(`/render/${testBase}shadow-dom-polyfill-loader.html?wc-inject-shadydom`);
86+
t.is(res.status, 200);
87+
t.true(res.text.indexOf('shadow-root-text') != -1);
88+
});
89+
8390
test('renders shadow DOM - webcomponents-lite.js polyfill', async(t) => {
8491
const server = await createServer();
8592
const res = await server.get(`/render/${testBase}shadow-dom-polyfill-all.html?wc-inject-shadydom=true`);

test/resources/explicit-render-event.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
}, 5000);
2121
setTimeout(() => {
2222
document.body.textContent = 'should not be reached';
23-
}, 10000);
23+
}, 11000);
2424
</script>

0 commit comments

Comments
 (0)