@@ -3,6 +3,7 @@ import { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';
33import { DEV } from 'esm-env' ;
44import { init_array_prototype_warnings } from '../dev/equality.js' ;
55import { get_descriptor , is_extensible } from '../../shared/utils.js' ;
6+ import { TEXT_NODE } from '#client/constants' ;
67
78// export these for reference in the compiled code, making global name deduplication unnecessary
89/** @type {Window } */
@@ -113,7 +114,7 @@ export function child(node, is_text) {
113114 // Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty
114115 if ( child === null ) {
115116 child = hydrate_node . appendChild ( create_text ( ) ) ;
116- } else if ( is_text && child . nodeType !== 3 ) {
117+ } else if ( is_text && child . nodeType !== TEXT_NODE ) {
117118 var text = create_text ( ) ;
118119 child ?. before ( text ) ;
119120 set_hydrate_node ( text ) ;
@@ -143,7 +144,7 @@ export function first_child(fragment, is_text) {
143144
144145 // if an {expression} is empty during SSR, there might be no
145146 // text node to hydrate — we must therefore create one
146- if ( is_text && hydrate_node ?. nodeType !== 3 ) {
147+ if ( is_text && hydrate_node ?. nodeType !== TEXT_NODE ) {
147148 var text = create_text ( ) ;
148149
149150 hydrate_node ?. before ( text ) ;
@@ -174,11 +175,9 @@ export function sibling(node, count = 1, is_text = false) {
174175 return next_sibling ;
175176 }
176177
177- var type = next_sibling ?. nodeType ;
178-
179178 // if a sibling {expression} is empty during SSR, there might be no
180179 // text node to hydrate — we must therefore create one
181- if ( is_text && type !== 3 ) {
180+ if ( is_text && next_sibling ?. nodeType !== TEXT_NODE ) {
182181 var text = create_text ( ) ;
183182 // If the next sibling is `null` and we're handling text then it's because
184183 // the SSR content was empty for the text, so we need to generate a new text
0 commit comments