mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
config redirect
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* matchesSelector v2.0.2
|
||||
* matchesSelector( element, '.selector' )
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
/*jshint browser: true, strict: true, undef: true, unused: true */
|
||||
|
||||
( function( window, factory ) {
|
||||
/*global define: false, module: false */
|
||||
'use strict';
|
||||
// universal module definition
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( factory );
|
||||
} else if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// browser global
|
||||
window.matchesSelector = factory();
|
||||
}
|
||||
|
||||
}( window, function factory() {
|
||||
'use strict';
|
||||
|
||||
var matchesMethod = ( function() {
|
||||
var ElemProto = window.Element.prototype;
|
||||
// check for the standard method name first
|
||||
if ( ElemProto.matches ) {
|
||||
return 'matches';
|
||||
}
|
||||
// check un-prefixed
|
||||
if ( ElemProto.matchesSelector ) {
|
||||
return 'matchesSelector';
|
||||
}
|
||||
// check vendor prefixes
|
||||
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 );
|
||||
};
|
||||
|
||||
}));
|
||||
Reference in New Issue
Block a user