A simple CSS specificity calculator
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
README.md
ouispecify.js

README.md

A Simple CSS Specificity Calculator

Call specify() with your css selectors, you'll receive an object with both the specificity number & the details.

Example

specify('h1#title');                
// returns {specificity: [1,0,1],
            details: [['#title'],[],['h1']]};

Project Page & Live example

Resources

Tests

Tests use the Jasmine framework. To play around with the tests you'll need to start a web server:

python -m SimpleHTTPServer

And then navigate to http://localhost:8000/test.

Tree

.
├── README.md
├── ouispecify.js
└── test
    ├── index.html
    ├── lib
    │   └── jasmine-1.3.1
    │       ├── MIT.LICENSE
    │       ├── jasmine-html.js
    │       ├── jasmine.css
    │       └── jasmine.js
    └── spec
        └── ouispecify.spec.js

Thanks

Special thanks to Lauren and Tom.

License

MIT