closure/goog/html/cssspecificity.js
function replaceWithEmptyText(selector, specificity, regex, typeIndex) {
  return selector.replace(regex, function(match) {
    specificity[typeIndex] += 1;
    // Replace this simple selector with whitespace so it won't be counted
    // in further simple selectors.
    return Array(match.length + 1).join(' ');
  });
}
function replaceWithEmptyText(selector, specificity, regex, typeIndex) {
  return selector.replace(regex, function(match) {
    specificity[typeIndex] += 1;
    // Replace this simple selector with whitespace so it won't be counted
    // in further simple selectors.
    return Array(match.length + 1).join(' ');
  });
}
function replaceWithEmptyText ( selector , specificity , regex , typeIndex ) { return selector . replace ( regex , function ( match ) { specificity [ typeIndex ] += 1 ; // Replace this simple selector with whitespace so it won't be counted // in further simple selectors. return Array ( match . length + 1 ) . join ( ' ' ) ; } ) ; }
Find matches for a regular expression in the selector and increase count.
@param {string} selector The selector to match the regex with.
@param {!Array<number>} specificity The current specificity.
@param {!RegExp} regex The regular expression.
@param {number} typeIndex Index of type count.
@return {string}
Find matches for a regular expression in the selector and increase count .