Support jQuery < 1.6 by not using $.fn.is().

Adapted from rooby's pull request for issue #1555.