How to detect if browser support specified css pseudo-class?

Raiden picture Raiden · Dec 16, 2011 · Viewed 7.9k times · Source

What's concept of detecting support of any css pseudo-class in browser through JavaScript? Exactly, I want to check if user's browser supports :checked pseudo-class or not, because I've made some CSS-popups with checkboxes and needs to do fallbacks for old browsers.

ANSWER: I'm found already implemented method of testing css selectors in a Modernizr "Additional Tests".

Answer

andychups picture andychups · Dec 16, 2011

You can simply check if your style with pseudo-class was applied.

Something like this: http://jsfiddle.net/qPmT2/1/