dist/polyfill.object-fit.js
function (selector) {
		var score = [0, 0, 0];
		var parts = selector.split(' ');
		var part;
		var match;

		//TODO: clean the ':not' part since the last ELEMENT_RE will pick it up
		while (part = parts.shift(), typeof part === 'string') {
			// find all pseudo-elements
			match = _find(part, PSEUDO_ELEMENTS_RE);
			score[2] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_ELEMENTS_RE, ''));
			// find all pseudo-classes
			match = _find(part, PSEUDO_CLASSES_RE);
			score[1] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_CLASSES_RE, ''));
			// find all attributes
			match = _find(part, ATTR_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(ATTR_RE, ''));
			// find all IDs
			match = _find(part, ID_RE);
			score[0] = match;
			// and remove them
			match && (part = part.replace(ID_RE, ''));
			// find all classes
			match = _find(part, CLASS_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(CLASS_RE, ''));
			// find all elements
			score[2] += _find(part, ELEMENT_RE);
		}

		return parseInt(score.join(''), 10);
	}
function (selector) {
		var score = [0, 0, 0];
		var parts = selector.split(' ');
		var part;
		var match;

		//TODO: clean the ':not' part since the last ELEMENT_RE will pick it up
		while (part = parts.shift(), typeof part === 'string') {
			// find all pseudo-elements
			match = _find(part, PSEUDO_ELEMENTS_RE);
			score[2] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_ELEMENTS_RE, ''));
			// find all pseudo-classes
			match = _find(part, PSEUDO_CLASSES_RE);
			score[1] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_CLASSES_RE, ''));
			// find all attributes
			match = _find(part, ATTR_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(ATTR_RE, ''));
			// find all IDs
			match = _find(part, ID_RE);
			score[0] = match;
			// and remove them
			match && (part = part.replace(ID_RE, ''));
			// find all classes
			match = _find(part, CLASS_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(CLASS_RE, ''));
			// find all elements
			score[2] += _find(part, ELEMENT_RE);
		}

		return parseInt(score.join(''), 10);
	}
function ( selector ) { var score = [ 0 , 0 , 0 ] ; var parts = selector . split ( ' ' ) ; var part ; var match ; //TODO: clean the ':not' part since the last ELEMENT_RE will pick it up while ( part = parts . shift ( ) , typeof part === 'string' ) { // find all pseudo-elements match = _find ( part , PSEUDO_ELEMENTS_RE ) ; score [ 2 ] = match ; // and remove them match && ( part = part . replace ( PSEUDO_ELEMENTS_RE , '' ) ) ; // find all pseudo-classes match = _find ( part , PSEUDO_CLASSES_RE ) ; score [ 1 ] = match ; // and remove them match && ( part = part . replace ( PSEUDO_CLASSES_RE , '' ) ) ; // find all attributes match = _find ( part , ATTR_RE ) ; score [ 1 ] += match ; // and remove them match && ( part = part . replace ( ATTR_RE , '' ) ) ; // find all IDs match = _find ( part , ID_RE ) ; score [ 0 ] = match ; // and remove them match && ( part = part . replace ( ID_RE , '' ) ) ; // find all classes match = _find ( part , CLASS_RE ) ; score [ 1 ] += match ; // and remove them match && ( part = part . replace ( CLASS_RE , '' ) ) ; // find all elements score [ 2 ] += _find ( part , ELEMENT_RE ) ; } return parseInt ( score . join ( '' ) , 10 ) ; }
calculates the specificity of a given `selector`
calculates the specificity of a given selector