diff --git a/packages/svelte/src/internal/server/index.js b/packages/svelte/src/internal/server/index.js index a72e81ae68..960d664123 100644 --- a/packages/svelte/src/internal/server/index.js +++ b/packages/svelte/src/internal/server/index.js @@ -551,19 +551,14 @@ export function maybe_selected(payload, value) { * @returns {void} */ export function valueless_option(payload, children) { - // store the initial payload before rendering children - let i = payload.out.length; + var i = payload.out.length; - // execute the child to get the runtime body of the option children(); - // remove the initial payload and eventual hydration comments - let body = payload.out.slice(i); + var body = payload.out.slice(i); - // check the value of the body with the select_value if (body.replace(//g, '') === payload.select_value) { - // substring the initial payload to remove the last character (the closing `>`) - // append selected and the body (the closing tag will be added later) + // replace '>' with ' selected>' (closing tag will be added later) payload.out = payload.out.slice(0, i - 1) + ' selected>' + body; } }