Conflict Prototype.js and noUiSlider : can drag handles on mobile devices
See original GitHub issueHi,
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:
- Created 5 years ago
- Reactions:1
- Comments:15 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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).
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);