Skip to content

Commit 7097769

Browse files
committed
fix: Ensure isodata script tag will pass spec validators
1 parent 3e1d2c4 commit 7097769

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/hydrate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let initialized;
55
/** @type {typeof hydrativeRender} */
66
export function hydrate(jsx, parent) {
77
if (typeof window === 'undefined') return;
8-
let isodata = document.querySelector('script[type=isodata]');
8+
let isodata = document.getElementById('isodata');
99
// @ts-ignore-next
1010
parent = parent || (isodata && isodata.parentNode) || document.body;
1111
if (!initialized && isodata) {

src/prerender.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function prerender(vnode, options) {
3434

3535
try {
3636
let html = await renderToStringAsync(vnode);
37-
html += `<script type="isodata"></script>`;
37+
html += `<script id="isodata"></script>`;
3838
return { html, links };
3939
} finally {
4040
vnodeHook = null;

test/node/prerender.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('extracts links', async () => {
2323
test('appends iso data script', async () => {
2424
const { html: h } = await prerender(html`<div />`);
2525
// Empty for now, but used for hydration vs render detection
26-
assert.match(h, /<script type="isodata"><\/script>/, 'missing iso data script tag');
26+
assert.match(h, /<script id="isodata"><\/script>/, 'missing iso data script tag');
2727
});
2828

2929
test.run();

0 commit comments

Comments
 (0)