From eb04d753bb1ffbfb4cc25713cc391b5f68c0eb2a Mon Sep 17 00:00:00 2001 From: furnace Date: Mon, 6 Aug 2018 16:00:24 -0600 Subject: [PATCH] Updated Sortable.js to catch empty "order" array If I don't set up the Store Get function (because I'm only using Set) fully, I get the error "TypeError: order is undefined" at line 1057 of Sortable.js. (I don't want to change the order of the original list so I don't have a return statement, or return null.) This fixes that error message. --- Sortable.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sortable.js b/Sortable.js index 8b32dfb..db811ee 100644 --- a/Sortable.js +++ b/Sortable.js @@ -1117,12 +1117,14 @@ } }, this); - order.forEach(function (id) { - if (items[id]) { - rootEl.removeChild(items[id]); - rootEl.appendChild(items[id]); - } - }); + if (typeof order !== 'undefined') { + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + } },