From 9cd02ab5f03df33a664d2945a629b8bbcdbb7abd Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 28 May 2025 18:11:46 -0400 Subject: [PATCH] tweak ("execute the child" is the sort of thing that gets you visited by the FBI) --- packages/svelte/src/internal/server/index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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; } }