From c7257ae198ba136ebec55b9cfae760f9e89c4e9a Mon Sep 17 00:00:00 2001 From: Bogdan Mustiata Date: Tue, 3 Mar 2015 14:53:15 +0100 Subject: [PATCH] Don't join class names when removing classes after additions. --- Sortable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index a3cb20e..e7bb2fe 100644 --- a/Sortable.js +++ b/Sortable.js @@ -896,7 +896,10 @@ el.classList[state ? 'add' : 'remove'](name); } else { - var className = (' ' + el.className + ' ').replace(/\s+/g, ' ').replace(' ' + name + ' ', ''); + var className = (' ' + el.className + ' ') + .replace(/\s+/g, ' ') + .replace(' ' + name + ' ', ' ') + .replace(/ /, ' '); el.className = className + (state ? ' ' + name : ''); } }