CSS3 selector specificity calculator.
css-specificity is wrapper module of specimen.
Installation
$ npm install css-specificity
Example
var specificity = var calc = specificityvar winner = specificity console/*[ { 'selector': '.class', 'specificity': [0, 0, 1, 0], 'a': 0, 'b': 1, 'c': 0 }, { 'selector': 'p.sel:after', 'specificity': [0, 0, 1, 2], 'a': 0, 'b': 1, 'c': 2 }]*/ console// 'p.sel:after'
API
specificity.calc(selector)
return caluculation result.
specificity.vs(selector1, selector2)
return selector has higher specificity.
License
The MIT License (MIT)
Copyright (c) 2014 Masaaki Morishita