function getSpecificity(selector) {
  if (userAgentProduct.IE && !userAgent.isVersionOrHigher(9)) {
    // IE8 has buggy regex support.
    return [0, 0, 0, 0];
  }
  var specificity = specificityCache.hasOwnProperty(selector) ?
      specificityCache[selector] :
      null;
  if (specificity) {
    return specificity;
  }
  if (Object.keys(specificityCache).length > (1 << 16)) {
    // Limit the size of cache to (1 << 16) == 65536. Normally HTML pages don't
    // have such numbers of selectors.
    specificityCache = {};
  }
  specificity = calculateSpecificity(selector);
  specificityCache[selector] = specificity;
  return specificity;
}
function getSpecificity(selector) {
  if (userAgentProduct.IE && !userAgent.isVersionOrHigher(9)) {
    // IE8 has buggy regex support.
    return [0, 0, 0, 0];
  }
  var specificity = specificityCache.hasOwnProperty(selector) ?
      specificityCache[selector] :
      null;
  if (specificity) {
    return specificity;
  }
  if (Object.keys(specificityCache).length > (1 << 16)) {
    // Limit the size of cache to (1 << 16) == 65536. Normally HTML pages don't
    // have such numbers of selectors.
    specificityCache = {};
  }
  specificity = calculateSpecificity(selector);
  specificityCache[selector] = specificity;
  return specificity;
}
function getSpecificity ( selector ) { if ( userAgentProduct . IE && ! userAgent . isVersionOrHigher ( 9 ) ) { // IE8 has buggy regex support. return [ 0 , 0 , 0 , 0 ] ; } var specificity = specificityCache . hasOwnProperty ( selector ) ? specificityCache [ selector ] : null ; if ( specificity ) { return specificity ; } if ( Object . keys ( specificityCache ) . length > ( 1 << 16 ) ) { // Limit the size of cache to (1 << 16) == 65536. Normally HTML pages don't // have such numbers of selectors. specificityCache = { } ; } specificity = calculateSpecificity ( selector ) ; specificityCache [ selector ] = specificity ; return specificity ; }
Calculates the specificity of CSS selectors, using a global cache if
supported.
@see http://www.w3.org/TR/css3-selectors/#specificity
@see https://specificity.keegan.st/
@param {string} selector The CSS selector.
@return {!Array<number>} The CSS specificity.
@supported IE9+, other browsers.
Calculates the specificity of CSS selectors using a global cache if supported .
Returns the specificity of a selector.