浏览代码

Ensure closestDataStack exists before using as it wasn't introduced until 3.5.2 (#2721)

Josh 3 年之前
父节点
当前提交
c7be8a8520
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      packages/morph/src/morph.js

+ 1 - 1
packages/morph/src/morph.js

@@ -23,7 +23,7 @@ export async function morph(from, toHtml, options) {
 
     // If there is no x-data on the element we're morphing,
     // let's seed it with the outer Alpine scope on the page.
-    if (window.Alpine && ! from._x_dataStack) {
+    if (window.Alpine && window.Alpine.closestDataStack && ! from._x_dataStack) {
         toEl._x_dataStack = window.Alpine.closestDataStack(from)
 
         toEl._x_dataStack && window.Alpine.clone(from, toEl)