From b8a358a5f653e35c5d14837d886673c8584d2018 Mon Sep 17 00:00:00 2001 From: FriendlyWeb Date: Mon, 18 Dec 2017 08:58:22 +1300 Subject: [PATCH] Use Element.matches for improved selector support --- Sortable.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Sortable.js b/Sortable.js index ad3a915..39fc950 100644 --- a/Sortable.js +++ b/Sortable.js @@ -1427,15 +1427,11 @@ function _matches(/**HTMLElement*/el, /**String*/selector) { if (el) { - selector = selector.split('.'); - - var tag = selector.shift().toUpperCase(), - re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g'); - - return ( - (tag === '' || el.nodeName.toUpperCase() == tag) && - (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) - ); + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } } return false;