Prechádzať zdrojové kódy

speed-up transitionIn & transitionOut
Benchmark: https://www.measurethat.net/Benchmarks/Show/8658/alpinejs-speed-up-transitionin-transitionout

Parviz/Ibragim Bekliev 5 rokov pred
rodič
commit
f2b0a13c9d
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      src/utils.js

+ 2 - 2
src/utils.js

@@ -182,7 +182,7 @@ export function transitionIn(el, show, component, forceSkip = false) {
 
         transitionHelperIn(el, modifiers, show)
     // Otherwise, we can assume x-transition:enter.
-    } else if (attrs.filter(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value)).length > 0) {
+    } else if (attrs.some(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value))) {
         transitionClassesIn(el, component, attrs, show)
     } else {
     // If neither, just show that damn thing.
@@ -208,7 +208,7 @@ export function transitionOut(el, hide, component, forceSkip = false) {
             ? modifiers.filter((i, index) => index > modifiers.indexOf('out')) : modifiers
 
         transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hide)
-    } else if (attrs.filter(attr => ['leave', 'leave-start', 'leave-end'].includes(attr.value)).length > 0) {
+    } else if (attrs.some(attr => ['leave', 'leave-start', 'leave-end'].includes(attr.value))) {
         transitionClassesOut(el, component, attrs, hide)
     } else {
         hide()