From 027e0ca95f8d0cdf34ca290ba83248fa7a5deb09 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Mon, 21 Dec 2015 11:58:40 +0100 Subject: [PATCH] Break up checkDragDropSupport conditions for readability --- src/plugins/DragDrop.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/DragDrop.js b/src/plugins/DragDrop.js index 79d9ef2a1..2ef5ba606 100644 --- a/src/plugins/DragDrop.js +++ b/src/plugins/DragDrop.js @@ -39,9 +39,20 @@ export default class DragDrop extends Plugin { */ checkDragDropSupport() { const div = document.createElement('div'); - return (('draggable' in div) || - ('ondragstart' in div && 'ondrop' in div)) && - 'FormData' in window && 'FileReader' in window; + + if (!('draggable' in div) || !('ondragstart' in div && 'ondrop' in div)) { + return false; + } + + if (!('FormData' in window)) { + return false; + } + + if (!('FileReader' in window)) { + return false; + } + + return true; } listenForEvents() {