From 77675363819beadf457835c9c0b58185fe5b94e6 Mon Sep 17 00:00:00 2001 From: Adam Fleming Date: Fri, 12 Jun 2015 15:03:20 -0400 Subject: [PATCH] Correctly match multiple class names Assume that el.className === "foo bar" Assume that your selector is "DIV.foo.bar" (' ' + el.className + ' ').match(re) will only have one match - " foo " - because the "\\s" trailing character on "foo" prevents " bar " from being matched EZ fix is just to make sure the trailing whitespace is not consumed by the regex --- Sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index cf0b5f0..5c619b5 100644 --- a/Sortable.js +++ b/Sortable.js @@ -885,7 +885,7 @@ selector = selector.split('.'); var tag = selector.shift().toUpperCase(), - re = new RegExp('\\s(' + selector.join('|') + ')\\s', 'g'); + re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g'); do { if (