Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ontouchmove function throws error after content is loaded #740

Open
boazbch opened this issue Feb 12, 2018 · 3 comments
Open

Ontouchmove function throws error after content is loaded #740

boazbch opened this issue Feb 12, 2018 · 3 comments

Comments

@boazbch
Copy link

boazbch commented Feb 12, 2018

Hi all,

It seems that for laptops with integrated touch screen the following problem occurs when loading content dynamically:

  • "this.remove" is invoked.
  • as a part of handling the memory leakage issue, the last line in this method is "self = null;".
  • the next call would be of "self.ontouchmove" function.
  • the first condition of this function is "if (!self.rail.drag) return true;".
  • since "self" is null at this point, an exception is being thrown.

Is there an override for this issue for laptops with touch-screen? maybe an option that can be disabled?

Thanks.

@glacios
Copy link

glacios commented Sep 2, 2020

When I used bind instead of delegate for this event the error had disappeared. At the moment don't know why though

--- a/jquery.nicescroll.js
+++ b/jquery.nicescroll.js
@@ -1650,7 +1650,7 @@
           });
           self.bind(self.win, "pointerdown", self.ontouchstart);
           self.bind(_doc, "pointerup", self.ontouchend);
-          self.delegate(_doc, "pointermove", self.ontouchmove);
+          self.bind(_doc, "pointermove", self.ontouchmove);
         } else if (cap.hasmstouch) { //IE10
           self.css((self.ispage) ? $("html") : self.win, { '-ms-touch-action': 'none' });
           self.css(self.rail, {
@@ -1661,7 +1661,7 @@
           });
           self.bind(self.win, "MSPointerDown", self.ontouchstart);
           self.bind(_doc, "MSPointerUp", self.ontouchend);
-          self.delegate(_doc, "MSPointerMove", self.ontouchmove);
+          self.bind(_doc, "MSPointerMove", self.ontouchmove);
           self.bind(self.cursor, "MSGestureHold", function (e) {
             e.preventDefault();
           });
@@ -1672,7 +1672,7 @@
           self.bind(self.win, "touchstart", self.ontouchstart, false, true);
           self.bind(_doc, "touchend", self.ontouchend, false, true);
           self.bind(_doc, "touchcancel", self.ontouchend, false, true);
-          self.delegate(_doc, "touchmove", self.ontouchmove, false, true);
+          self.bind(_doc, "touchmove", self.ontouchmove, false, true);
         }

         if (opt.emulatetouch) {

@glacios
Copy link

glacios commented Sep 2, 2020

By the way, error also fires in IE 10 and 11 regardless device has touchscreen or not

@glacios
Copy link

glacios commented Sep 3, 2020

#697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants