function getSpecificity(selector) {
  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.