Skip to content

alixaxel/css-explain

 
 

Repository files navigation

CSS EXPLAIN

Think of it like SQL EXPLAIN, but for CSS selectors.

Usage

cssExplain("li .item")
{
  "selector": "li .item",
  "parts": ["li", ".item"],
  "specificity": [0, 1, 1],
  "category": "class",
  "key": "item",
  "score": 6
}

Results

  • selector - Selector input
  • parts - Parsed selector components
  • specificity - Computed specificy values as an Array (See W3C calcuating selector specificity)
  • category - Category key selector falls under (id/class/tag/universal)
  • key - Hash key used for indexing
  • score - 1-10 rating. 1 being the most efficient and 10 being the least.
  • messages - Array of infomational reasons for why the score was computed.

Contributing

$ git clone https://github.com/josh/css-explain.git
$ cd css-explain/

Run tests

$ make test

About

SQL EXPLAIN for CSS selectors

Resources

License

Stars

Watchers

Forks

Packages

No packages published