]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
style: fix incorrectly named variable in ignoreMousedisappear utility
authorNicolas Coden <nicolas@ncoden.fr>
Wed, 25 Jul 2018 21:59:34 +0000 (23:59 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Wed, 25 Jul 2018 21:59:34 +0000 (23:59 +0200)
js/foundation.core.utils.js

index 36e5cbde451a7ff43b02d315ab8db18e7fb8060d..65e32126d7856ef34c14dc1100e7a2d4e960f124 100644 (file)
@@ -109,8 +109,8 @@ function onLoad($elem, handler) {
  * @returns {Function} - filtered handler to use to listen on the `mouseleave` event.
  */
 function ignoreMousedisappear(handler, { ignoreLeaveWindow = false, ignoreReappear = false } = {}) {
-  return function leaveEventHandler(eEnter, ...rest) {
-    const callback = handler.bind(this, eEnter, ...rest);
+  return function leaveEventHandler(eLeave, ...rest) {
+    const callback = handler.bind(this, eLeave, ...rest);
 
     // In firefox if the user switched between windows, the window sill have the focus by the time
     // the event is triggered. We have to debounce the event to test this case.
@@ -118,7 +118,7 @@ function ignoreMousedisappear(handler, { ignoreLeaveWindow = false, ignoreReappe
 
       // The mouse left: call the given callback...
       // - if the mouse entered elsewhere (`relatedTarget` is where)
-      if (eEnter.relatedTarget !== null
+      if (eLeave.relatedTarget !== null
       // - if the user switched to an other window (and we don't ignore it)
         || !ignoreLeaveWindow && document.hasFocus && !document.hasFocus()) {
         callback();
@@ -128,10 +128,10 @@ function ignoreMousedisappear(handler, { ignoreLeaveWindow = false, ignoreReappe
       else if (!ignoreReappear) {
         $(document).one('mouseenter', function reenterEventHandler(eReenter) {
           // - if the mouse reentered outside of the element it left.
-          if (!$(eEnter.currentTarget).has(eReenter.target).length) {
+          if (!$(eLeave.currentTarget).has(eReenter.target).length) {
 
             // Fill where the mouse finally entered.
-            eEnter.relatedTarget = eReenter.target;
+            eLeave.relatedTarget = eReenter.target;
             callback();
 
           }