Explorar o código

Undelegate event handlers when instance is removed

Closes #762
t.kacperek %!s(int64=5) %!d(string=hai) anos
pai
achega
43f37b9b79
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      jquery.nicescroll.js

+ 8 - 0
jquery.nicescroll.js

@@ -2630,6 +2630,14 @@
       if (self.cursortimeout) clearTimeout(self.cursortimeout);
       for (var n in self.delaylist) if (self.delaylist[n]) clearAnimationFrame(self.delaylist[n].h);
       self.doZoomOut();
+
+      if (cap.hasw3ctouch) { //IE11+
+        self.undelegate(_doc, "pointermove", self.ontouchmove);
+      } else if (cap.hasmstouch) { //IE10
+        self.undelegate(_doc, "MSPointerMove", self.ontouchmove);
+      } else if (cap.cantouch) { // smartphones/touch devices
+        self.undelegate(_doc, "touchmove", self.ontouchmove, false, true);
+      }
       self.unbindAll();
 
       if (cap.isie9) self.win[0].detachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug