Przeglądaj źródła

Remove ?. syntax to support Safari 12

Caleb Porzio 3 lat temu
rodzic
commit
a3ab9b0e1f
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      packages/alpinejs/src/directives/x-if.js

+ 7 - 1
packages/alpinejs/src/directives/x-if.js

@@ -27,7 +27,13 @@ directive('if', (el, { expression }, { effect, cleanup }) => {
         return clone
         return clone
     }
     }
 
 
-    let hide = () => el._x_undoIf?.() || delete el._x_undoIf
+    let hide = () => {
+        if (! el._x_undoIf) return
+
+        el._x_undoIf()
+
+        delete el._x_undoIf
+    }
 
 
     effect(() => evaluate(value => {
     effect(() => evaluate(value => {
         value ? show() : hide()
         value ? show() : hide()