Normally, i’m using Modernizr for regular feature detection but it can’t detect browser selector support (i.e: :nth-of-type() selector).
Is there a way to detect selector support of browser with jQuery?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are right that selecting an element with a jQuery selector will work even in browsers that do not support that selector in CSS.
However, you could apply a style with a CSS3 selector, and then select an element with jQuery to determine if that style has been applied.
For instance in CSS:
and then in jQuery:
However be careful because
.css()may not return what you expect. For instance if you apply a color like ‘red’, it will returnrgb(255, 0, 0).Sorry I know this isn’t as perfect of a solution as Modernizr, but I hope it helps you in your situation.