File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed
Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -23,22 +23,21 @@ function canDragX(draggable) {
2323 draggable . props . axis === 'x' ;
2424}
2525
26- function isFunction ( fn ) {
27- return typeof fn === 'function' ;
28- }
29-
3026function matchesSelector ( el , selector ) {
31- if ( isFunction ( el . matches ) ) {
32- return el . matches ( selector ) ;
33- } else if ( isFunction ( el . webkitMatchesSelector ) ) {
34- return el . webkitMatchesSelector ( selector ) ;
35- } else if ( isFunction ( el . mozMatchesSelector ) ) {
36- return el . mozMatchesSelector ( selector ) ;
37- } else if ( isFunction ( el . msMatchesSelector ) ) {
38- return el . msMatchesSelector ( selector ) ;
39- } else if ( isFunction ( el . oMatchesSelector ) ) {
40- return el . oMatchesSelector ( selector ) ;
41- }
27+ var matcheMethods = [
28+ 'matches' ,
29+ 'webkitMatchesSelector' ,
30+ 'mozMatchesSelector' ,
31+ 'msMatchesSelector' ,
32+ 'oMatchesSelector'
33+ ] ,
34+ length = matcheMethods . length ;
35+
36+ for ( var i = 0 ; i < length ; i ++ ) {
37+ if ( typeof el [ matcheMethods [ i ] ] === 'function' ) {
38+ return el [ matcheMethods [ i ] ] ( selector ) ;
39+ }
40+ }
4241}
4342
4443function addEvent ( el , event , handler ) {
You can’t perform that action at this time.
0 commit comments