1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- ( function( window, factory ) {
-
- 'use strict';
-
- if ( typeof define == 'function' && define.amd ) {
-
- define( factory );
- } else if ( typeof module == 'object' && module.exports ) {
-
- module.exports = factory();
- } else {
-
- window.matchesSelector = factory();
- }
- }( window, function factory() {
- 'use strict';
- var matchesMethod = ( function() {
- var ElemProto = window.Element.prototype;
-
- if ( ElemProto.matches ) {
- return 'matches';
- }
-
- if ( ElemProto.matchesSelector ) {
- return 'matchesSelector';
- }
-
- var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
- for ( var i=0; i < prefixes.length; i++ ) {
- var prefix = prefixes[i];
- var method = prefix + 'MatchesSelector';
- if ( ElemProto[ method ] ) {
- return method;
- }
- }
- })();
- return function matchesSelector( elem, selector ) {
- return elem[ matchesMethod ]( selector );
- };
- }));
|