scancss
Version:
A robust CSS stylesheet statistics collector and analyzer
26 lines (18 loc) • 926 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.handleZIndex = handleZIndex;
var _cssExplicitDefaultingKeywords = require('../../../constants/cssExplicitDefaultingKeywords');
var _reCssVariable = require('../../../constants/reCssVariable');
var _countUsage = require('../../../calculators/countUsage');
const zIndexAllowedKeywords = ['auto', ..._cssExplicitDefaultingKeywords.cssExplicitDefaultingKeywords];
function handleZIndex(decl, report) {
const propValue = decl.value;
report.zIndices.total++;
(0, _countUsage.countUsage)(propValue, report.zIndices.usage);
/** Count invalid z-indices */
if (Number.isInteger(Number(propValue)) === false && zIndexAllowedKeywords.includes(propValue) === false && propValue.startsWith('calc(') === false && _reCssVariable.reCssVariable.test(propValue) === false) {
(0, _countUsage.countUsage)(propValue, report.zIndices.invalid);
}
}