Browse Source

Merge pull request #1251 from andrews05/master

Use Element.matches for improved selector support
pull/1274/head
Lebedev Konstantin 7 years ago committed by GitHub
parent
commit
94ffa4bee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      Sortable.js

14
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;

Loading…
Cancel
Save