Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
SQL EXPLAIN for CSS selectors
branch: master

This branch is 11 commits behind josh:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.jshintrc
LICENSE
Makefile
README.md
component.json
css-explain.js
index.js
package.json
test.js

README.md

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
Something went wrong with that request. Please try again.