chore: use clear_text_content in more areas (#11512)

pull/11503/head
Dominic Gannaway 8 months ago committed by GitHub
parent f543856cc3
commit 3c756cf14c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -9,7 +9,7 @@ import {
HYDRATION_START HYDRATION_START
} from '../../../../constants.js'; } from '../../../../constants.js';
import { hydrate_anchor, hydrate_nodes, hydrating, set_hydrating } from '../hydration.js'; import { hydrate_anchor, hydrate_nodes, hydrating, set_hydrating } from '../hydration.js';
import { empty } from '../operations.js'; import { clear_text_content, empty } from '../operations.js';
import { remove } from '../reconciler.js'; import { remove } from '../reconciler.js';
import { untrack } from '../../runtime.js'; import { untrack } from '../../runtime.js';
import { import {
@ -67,7 +67,7 @@ function pause_effects(items, controlled_anchor, callback) {
// DOM element, so we can apply a fast-path for clearing the contents of the element. // DOM element, so we can apply a fast-path for clearing the contents of the element.
if (length > 0 && transitions.length === 0 && controlled_anchor !== null) { if (length > 0 && transitions.length === 0 && controlled_anchor !== null) {
var parent_node = /** @type {Element} */ (controlled_anchor.parentNode); var parent_node = /** @type {Element} */ (controlled_anchor.parentNode);
parent_node.textContent = ''; clear_text_content(parent_node);
parent_node.append(controlled_anchor); parent_node.append(controlled_anchor);
} }

@ -1,5 +1,6 @@
import { hydrating } from '../hydration.js'; import { hydrating } from '../hydration.js';
import { effect } from '../../reactivity/effects.js'; import { effect } from '../../reactivity/effects.js';
import { clear_text_content } from '../operations.js';
/** /**
* @param {HTMLElement} dom * @param {HTMLElement} dom
@ -27,6 +28,6 @@ export function autofocus(dom, value) {
*/ */
export function remove_textarea_child(dom) { export function remove_textarea_child(dom) {
if (hydrating && dom.firstChild !== null) { if (hydrating && dom.firstChild !== null) {
dom.textContent = ''; clear_text_content(dom);
} }
} }

Loading…
Cancel
Save