From 3904b8f36c3ab1d87beea29989379b8513b4b600 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 3 Dec 2024 22:02:29 -0500 Subject: [PATCH] belt and braces --- .../svelte/src/internal/client/dom/elements/misc.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/elements/misc.js b/packages/svelte/src/internal/client/dom/elements/misc.js index 3e0207c302..b102168377 100644 --- a/packages/svelte/src/internal/client/dom/elements/misc.js +++ b/packages/svelte/src/internal/client/dom/elements/misc.js @@ -1,4 +1,4 @@ -import { teardown } from '../../reactivity/effects.js'; +import { render_effect } from '../../reactivity/effects.js'; import { hydrating } from '../hydration.js'; import { clear_text_content, get_first_child } from '../operations.js'; import { queue_micro_task } from '../task.js'; @@ -62,9 +62,12 @@ export function add_form_reset_listener() { * @param {string} text */ export function title(text) { - const previous = document.title; - document.title = text; - teardown(() => { - document.title = previous; + render_effect(() => { + const previous = document.title; + document.title = text; + + return () => { + document.title = previous; + }; }); }