From: linzhe <40790268+linzhe141@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:41:58 +0000 (+0800) Subject: fix(hydration): avoid observing non-Element node (#11954) X-Git-Tag: v3.5.7~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7257e6a34200409b3fc347d3bb807e11e2785974;p=thirdparty%2Fvuejs%2Fcore.git fix(hydration): avoid observing non-Element node (#11954) close #11952 --- diff --git a/packages/runtime-core/src/hydrationStrategies.ts b/packages/runtime-core/src/hydrationStrategies.ts index 791ca9e525..bb98ea93c2 100644 --- a/packages/runtime-core/src/hydrationStrategies.ts +++ b/packages/runtime-core/src/hydrationStrategies.ts @@ -48,6 +48,7 @@ export const hydrateOnVisible: HydrationStrategyFactory< } }, opts) forEach(el => { + if (!(el instanceof Element)) return if (elementIsVisibleInViewport(el)) { hydrate() ob.disconnect() diff --git a/packages/vue/__tests__/e2e/hydration-strat-visible.html b/packages/vue/__tests__/e2e/hydration-strat-visible.html index 7b3b5ddf35..489222f860 100644 --- a/packages/vue/__tests__/e2e/hydration-strat-visible.html +++ b/packages/vue/__tests__/e2e/hydration-strat-visible.html @@ -11,9 +11,12 @@