basic selector compatablity between jquery 1.4.2 and 1.2.1

basic selector compatablity between jquery 1.4.2 and 1.2.1

I am upgrading the jQuery version of my site from jquery 1.2.1 to 1.4.2.  

When using a basic id selector with an "empty" name throws a JavaScript error is thrown when using jQuery 1.4.2 but not when using jQuery 1.2.1 (see example and error below).

example: $('#').addClass('current');
error: Error: uncaught exception: Syntax error, unrecognized expression: #

I realize this is a JavaScript bug that should be re mediated but removing the "bad" line of js code but this has been generated onto hundreds of pages of my site and bulk regenerating them would require a page by page checkout.

Is there a way I could patch or workaround this problem myself if only until all pages are remediated?