Skip to content

Commit 94ffa4b

Browse files
authored
Merge pull request #1251 from andrews05/master
Use Element.matches for improved selector support
2 parents dc38e43 + b8a358a commit 94ffa4b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Sortable.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,15 +1427,11 @@
14271427

14281428
function _matches(/**HTMLElement*/el, /**String*/selector) {
14291429
if (el) {
1430-
selector = selector.split('.');
1431-
1432-
var tag = selector.shift().toUpperCase(),
1433-
re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
1434-
1435-
return (
1436-
(tag === '' || el.nodeName.toUpperCase() == tag) &&
1437-
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
1438-
);
1430+
if (el.matches) {
1431+
return el.matches(selector);
1432+
} else if (el.msMatchesSelector) {
1433+
return el.msMatchesSelector(selector);
1434+
}
14391435
}
14401436

14411437
return false;

0 commit comments

Comments
 (0)