# Wednesday, 03 October 2012
« Getting started with Mercurial for a sma... | Main | Upgrading an MVC4 Visual Studio 2010 Sol... »

I upgraded a project recently from 1.7.2 of jQuery to 1.8.2 and began testing my pages.  On one of my pages I was getting the following error:

unrecognized expression

Doing a little research I discovered that in the 1.8 release of jQuery they deprecated the :radio and other such pseudo-class selectors.  The preferred method moving forward is to use the equivalent CSS selector of [type=radio].

Here’s the jQuery 1.8 release notes and the ticket describing this change.

Why the removal?

From their radio selector page under the Additional Notes section:

Because :radio is a jQuery extension and not part of the CSS specification, queries using :radio cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use [type="radio"] instead.

And from the ticket page:

Deprecate (for eventual removal) the input type selectors: :file :image :password :radio :reset :submit :text -- They are basically aliases to [type="file"] [type="image"] but can't use querySelectorAll - I think having these selectors around in the long term future is entirely unnecessary and confusing.

Happy Coding! Smile

:radio | 1.8 | jQuery
Wednesday, 03 October 2012 13:42:34 (US Mountain Standard Time, UTC-07:00)
The problem is not that those selectors have been deprecated, although it is a good idea to avoid them since they are poor performers. The problem is that input:radio['apptBy']:checked is just not a valid selector at all, I am not sure what jQuery 1.7 was doing with it. The 1.8 parser is better at letting you know those things. Perhaps you meant input:radio[apptBy]:checked instead? An attribute name cannot be quoted, only an attribute value. Also, attribute names are not case sensitive.
Dave Methvin
Friday, 05 October 2012 07:59:02 (US Mountain Standard Time, UTC-07:00)
Thanks for the clarification. I started wondering about my original code after I made the change but you've made my mistake clear. :-)
Friday, 05 October 2012 08:20:26 (US Mountain Standard Time, UTC-07:00)
I love it when I learn something new. :-) I found several places in my code where I was using quotes and 1.7 was somehow more forgiving.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: b, blockquote@cite, em, i, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview