From 54e1a0c1efbe05ea0c3b5437867853976d074530 Mon Sep 17 00:00:00 2001 From: sasensi Date: Tue, 2 Oct 2018 10:31:49 +0200 Subject: [PATCH] Fix: calling event.preventDefault() on not cancelable events produces errors --- src/view/View.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/view/View.js b/src/view/View.js index 39e896da..71368ee6 100644 --- a/src/view/View.js +++ b/src/view/View.js @@ -1440,7 +1440,11 @@ new function() { // Injection scope for event handling on the browser // which can call `preventDefault()` explicitly or return `false`. // - If this is a unhandled mousedown event, but the view or tools // respond to mouseup. - if (called && !mouse.move || mouse.down && responds('mouseup')) + // + // Some events are not cancelable anyway (like during a scroll inertia + // on mobile) so trying to prevent default in those case would result + // in no effect and an error. + if (event.cancelable !== false && (called && !mouse.move || mouse.down && responds('mouseup'))) event.preventDefault(); },