Caleb Porzio před 5 roky
rodič
revize
0d36440e3b
3 změnil soubory, kde provedl 14 přidání a 9 odebrání
  1. 8 5
      dist/alpine.js
  2. 2 2
      src/directives/bind.js
  3. 4 2
      src/index.js

+ 8 - 5
dist/alpine.js

@@ -1471,11 +1471,14 @@
 
     executeAndClearNextTickStack(el) {
       // Skip spawns from alpine directives
-      if (el === this.$el) {
-        // Walk through the $nextTick stack and clear it as we go.
-        while (this.nextTickStack.length > 0) {
-          this.nextTickStack.shift()();
-        }
+      if (el === this.$el && this.nextTickStack.length > 0) {
+        // We run the tick stack after the next frame to allow any
+        // running transitions to pass the initial show stage.
+        requestAnimationFrame(() => {
+          while (this.nextTickStack.length > 0) {
+            this.nextTickStack.shift()();
+          }
+        });
       }
     }
 

+ 2 - 2
src/directives/bind.js

@@ -68,12 +68,12 @@ export function handleAttributeBindingDirective(component, el, attrName, express
             el.removeAttribute(attrName)
         } else {
             isBooleanAttr(attrName) ? setIfChanged(el, attrName, attrName) : setIfChanged(el, attrName, value)
-        } 
+        }
     }
 }
 
 function setIfChanged(el, attrName, value) {
-    if(el.getAttribute(attrName) != value){
+    if (el.getAttribute(attrName) != value){
         el.setAttribute(attrName, value)
     }
 }

+ 4 - 2
src/index.js

@@ -3,7 +3,9 @@ import { domReady, isTesting } from './utils'
 
 const Alpine = {
     version: process.env.PKG_VERSION,
-    pauseObserver: false,
+
+    pauseMutationObserver: false,
+
     start: async function () {
         if (! isTesting()) {
             await domReady()
@@ -54,7 +56,7 @@ const Alpine = {
         }
 
         const observer = new MutationObserver((mutations) => {
-            if (this.pauseObserver) return;
+            if (this.pauseMutationObserver) return;
 
             for (let i=0; i < mutations.length; i++){
                 if (mutations[i].addedNodes.length > 0) {