Browse Source

Use Element.matches for improved selector support

pull/1251/head
FriendlyWeb 7 years ago
parent
commit
b8a358a5f6
  1. 14
      Sortable.js

14
Sortable.js

@ -1427,15 +1427,11 @@
function _matches(/**HTMLElement*/el, /**String*/selector) { function _matches(/**HTMLElement*/el, /**String*/selector) {
if (el) { if (el) {
selector = selector.split('.'); if (el.matches) {
return el.matches(selector);
var tag = selector.shift().toUpperCase(), } else if (el.msMatchesSelector) {
re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g'); return el.msMatchesSelector(selector);
}
return (
(tag === '' || el.nodeName.toUpperCase() == tag) &&
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
);
} }
return false; return false;

Loading…
Cancel
Save