Possible Duplicate:
Sorting a set of CSS selectors on the basis of specificity
does anyone know of a way to find out the specificity of a css selector in javascript? is there some library or maybe even browser support? I hoped jquery would provide something but as far as I looked at the source/docs I didn't find anything.
it would be not to hard to write one on my own but I would prefer a proven solution. a css selector parser would also be useful.
I need it to sort a set of rules which match the same element by specificity.
specificity as in http://www.w3.org/TR/selectors/#specificity