Prechádzať zdrojové kódy

Remove ?. syntax to support Safari 12

Caleb Porzio 3 rokov pred
rodič
commit
a3ab9b0e1f
1 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  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
     }
 
-    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 => {
         value ? show() : hide()