How to fix the jQuery 1.8 “unsupported pseudo” error?

Mathias Bynens picture Mathias Bynens · Aug 10, 2012 · Viewed 9.1k times · Source

A plugin I’m using relies on $(':animated'), but since I upgraded to jQuery 1.8.0 this throws an error:

Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: animated

Did jQuery 1.8.0 drop support for this custom selector as part of its changes in Sizzle? How do I fix this?

Answer

Mathias Bynens picture Mathias Bynens · Aug 10, 2012

Don’t worry, jQuery 1.8.0 still supports the custom $(':animated') selector.

However, contrary to what you might expect, it’s not part of Sizzle (jQuery’s selector engine). If you’re using a custom build, make sure you don’t exclude the effects module, which defines the :animated selector.

For example, if you were creating a custom jQuery build using this command before:

grunt custom:-ajax,-deprecated,-effects

You’ll need to remove the -effects part, like this:

grunt custom:-ajax,-deprecated

Else the :animated selector won’t be supported.