浏览代码

fix issue when nested components are moved

Simone Todaro 5 年之前
父节点
当前提交
3cb86c43c6
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      dist/alpine-ie11.js
  2. 1 1
      dist/alpine.js
  3. 1 1
      src/component.js

+ 1 - 1
dist/alpine-ie11.js

@@ -6992,7 +6992,7 @@
 
                 if (node.nodeType !== 1 || node.__x_inserted_me) return;
 
-                if (node.matches('[x-data]')) {
+                if (node.matches('[x-data]') && !node.__x) {
                   node.__x = new Component(node);
                   return;
                 }

+ 1 - 1
dist/alpine.js

@@ -1592,7 +1592,7 @@
             mutations[i].addedNodes.forEach(node => {
               if (node.nodeType !== 1 || node.__x_inserted_me) return;
 
-              if (node.matches('[x-data]')) {
+              if (node.matches('[x-data]') && !node.__x) {
                 node.__x = new Component(node);
                 return;
               }

+ 1 - 1
src/component.js

@@ -352,7 +352,7 @@ export default class Component {
                     mutations[i].addedNodes.forEach(node => {
                         if (node.nodeType !== 1 || node.__x_inserted_me) return
 
-                        if (node.matches('[x-data]')) {
+                        if (node.matches('[x-data]') && ! node.__x) {
                             node.__x = new Component(node)
                             return
                         }