Skip to content

Commit 3c756cf

Browse files
authored
chore: use clear_text_content in more areas (#11512)
1 parent f543856 commit 3c756cf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
HYDRATION_START
1010
} from '../../../../constants.js';
1111
import { hydrate_anchor, hydrate_nodes, hydrating, set_hydrating } from '../hydration.js';
12-
import { empty } from '../operations.js';
12+
import { clear_text_content, empty } from '../operations.js';
1313
import { remove } from '../reconciler.js';
1414
import { untrack } from '../../runtime.js';
1515
import {
@@ -67,7 +67,7 @@ function pause_effects(items, controlled_anchor, callback) {
6767
// DOM element, so we can apply a fast-path for clearing the contents of the element.
6868
if (length > 0 && transitions.length === 0 && controlled_anchor !== null) {
6969
var parent_node = /** @type {Element} */ (controlled_anchor.parentNode);
70-
parent_node.textContent = '';
70+
clear_text_content(parent_node);
7171
parent_node.append(controlled_anchor);
7272
}
7373

packages/svelte/src/internal/client/dom/elements/misc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { hydrating } from '../hydration.js';
22
import { effect } from '../../reactivity/effects.js';
3+
import { clear_text_content } from '../operations.js';
34

45
/**
56
* @param {HTMLElement} dom
@@ -27,6 +28,6 @@ export function autofocus(dom, value) {
2728
*/
2829
export function remove_textarea_child(dom) {
2930
if (hydrating && dom.firstChild !== null) {
30-
dom.textContent = '';
31+
clear_text_content(dom);
3132
}
3233
}

0 commit comments

Comments
 (0)