config redirect

This commit is contained in:
Nuno Coração
2023-01-29 22:30:24 +00:00
parent 17557c7d73
commit 5fb4bd8083
9905 changed files with 1258996 additions and 36355 deletions
+2
View File
@@ -0,0 +1,2 @@
components/
bower_components/
+27
View File
@@ -0,0 +1,27 @@
# matchesSelector helper
[`matches`/`matchesSelector`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) is pretty hot :fire:, but has [vendor-prefix baggage](http://caniuse.com/#feat=matchesselector) :handbag: :pouch:. This helper function takes care of that, without polyfilling or augmenting `Element.prototype`.
``` js
matchesSelector( elem, selector );
// for example
matchesSelector( myElem, 'div.my-hawt-selector' );
```
## Install
Download [matches-selector.js](https://github.com/desandro/matches-selector/raw/master/matches-selector.js)
Install with [Bower](http://bower.io): `bower install matches-selector`
[Install with npm](https://www.npmjs.org/package/desandro-matches-selector): `npm install desandro-matches-selector`
## Browser support
IE10+, all modern browsers
Use [matchesSelector v1](https://github.com/desandro/matches-selector/releases/tag/v1.0.3) for IE8 and IE9 support.
## MIT license
matchesSelector is released under the [MIT license](http://desandro.mit-license.org)
+32
View File
@@ -0,0 +1,32 @@
{
"name": "matches-selector",
"description": "matches/matchesSelector helper",
"main": "matches-selector.js",
"devDependencies": {
"qunit": "1.x"
},
"homepage": "https://github.com/desandro/matches-selector",
"authors": [
"David DeSandro"
],
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"DOM",
"matchesSelector",
"matches"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"tests.*",
"package.json"
]
}
+53
View File
@@ -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 );
};
}));
+24
View File
@@ -0,0 +1,24 @@
{
"name": "desandro-matches-selector",
"version": "2.0.2",
"description": "matches/matchesSelector helper",
"main": "matches-selector.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/desandro/matches-selector.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/desandro/matches-selector/issues"
},
"homepage": "https://github.com/desandro/matches-selector",
"keywords": [
"DOM",
"matchesSelector",
"matches"
],
"author": "David DeSandro"
}
+25
View File
@@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>matchesSelector tests</title>
<link rel="stylesheet" href="bower_components/qunit/qunit/qunit.css" />
<script src="bower_components/qunit/qunit/qunit.js"></script>
</head>
<body>
<div id="alpha" class="item red"></div>
<div id="beta" class="item blue"></div>
<div id="gamma" class="item green"></div>
<div id="qunit"></div>
<script src="matches-selector.js"></script>
<script src="tests.js"></script>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
test( 'matchesSelector', function() {
equal( typeof matchesSelector, 'function', 'typeof is function' );
var alpha = document.getElementById('alpha');
equal( matchesSelector( alpha, '#alpha' ), true, '[#alpha] matches #alpha' );
equal( matchesSelector( alpha, '.item' ), true, '[#alpha] matches .item' );
equal( matchesSelector( alpha, 'div' ), true, '[#alpha] matches div' );
equal( matchesSelector( alpha, 'p' ), false, '[#alpha] does not match p' );
equal( matchesSelector( alpha, '.baz' ), false, '[#alpha] does not match .baz' );
equal( matchesSelector( alpha, '#alpha.item' ), true, '[#alpha] matches #alpha.item' );
equal( matchesSelector( alpha, '#alpha, foo'), true, '[#alpha] matches #alpha, foo' );
equal( matchesSelector( alpha, 'foo, .item'), true, '[#alpha] matches foo, .item' );
// orphaned elem
var beta = document.createElement('div');
beta.id = 'beta';
beta.className = 'foo bar';
equal( matchesSelector( beta, 'div' ), true, '[#beta] matches div' );
equal( matchesSelector( beta, '#beta' ), true, '[#beta] matches #beta' );
equal( matchesSelector( beta, '.bar' ), true, '[#beta] matches .bar' );
equal( matchesSelector( beta, 'p' ), false, '[#beta] does not match p' );
equal( matchesSelector( beta, '.baz' ), false, '[#beta] does not match .baz' );
equal( matchesSelector( beta, '#beta.bar' ), true, '[#alpha] matches #alpha.item' );
equal( matchesSelector( beta, '#beta, qux' ), true, '[#beta] matches #beta, qux' );
equal( matchesSelector( beta, '.qux, .bar'), true, '[#alpha] matches .qux, .bar' );
});