question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conflict Prototype.js and noUiSlider : can drag handles on mobile devices

See original GitHub issue

Hi,

I’m facing an issue already reported : #908 #902 The error occurred on mobile device on chrome, we can’t drag handles.

Uncaught TypeError: this.each is not a function
    at TouchList.findAll (prototype.js:883)
    at G (nouislider.min.js:3)
    at HTMLDivElement.f (nouislider.min.js:3)
Uncaught TypeError: this.each is not a function
    at TouchList.findAll (prototype.js:883)
    at fixEvent (nouislider.js:1473)
    at HTMLDivElement.method (nouislider.js:1387)

Can you have a look on this ?

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
manelaguayocommented, Jun 7, 2019

I simply added:

TouchList.prototype.each = Array.prototype.each; TouchList.prototype._each = Array.prototype._each;

to noUislider.min.js at beginning and seems to have fixed my issue(s).

1reaction
AndresInSpacecommented, Apr 30, 2019

In interest to retain the Magento 1.x defaults, as resetting the native Array prototype may conflict with Magento requirements/code, I simply added:

if(typeof TouchList === "function"){ //check if it exists cause Edge/IE it doesn't and will throw errors TouchList.prototype.each = Array.prototype.each; TouchList.prototype._each = Array.prototype._each; }

to noUislider.min.js at beginning and seems to have fixed my issue(s). The issue seems to stem from around line 721 where filter/find is overwritten by prototype.js, it doesn’t hang up for me here… but on the prototype extended method of filter/find calling this.each/this._each on the passed ‘l’ var. if ("touchstart" === t.type) { var u = Array.prototype.filter.call(t.touches, l); if (1 < u.length) return !1; n = u[0].pageX, i = u[0].pageY } else { var c = Array.prototype.find.call(t.changedTouches, l);

Read more comments on GitHub >

github_iconTop Results From Across the Web

problem with librabries conflict - nouislider.js and prototype.js ...
When I try to drag button and slide it to side, button doesn't move but in consolthe e I get error above but...
Read more >
NoUiSlider does not work properly - Stack Overflow
Both javascript and css files are correctly implemented. Any ideas why it's not working? UPDATE: As jsfiddle didn't work, here is a CodePen ......
Read more >
Viewing 500 results - Okler Themes
One question: What is the optimal way to add an extra jquery plugin in Porto HTML Template? ... If you follow their instructions...
Read more >
Welcome to Everything.js | Everything.js
SortableJS/Sortable - Sortable — is a JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports ...
Read more >
npm - Snyk
@alancnet/fantasy-names · @alexamies/chinesedict-js · @alifd/next ... @gulp-sourcemaps/identity-map · @guntur/phone-number-generator · @haensl/json-parser ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found