[jQuery] performance issues in IE

[jQuery] performance issues in IE

Hello,
I'm writing a function in a global script that will apply focus to the first visible enabled form field on a page. I'm using the following jQuery expression to find the control:
$('#mainContent :input:visible:not(:checkbox):not(:button):not(:submit):not(:image):not([@disabled]):first')
This works exactly as expected, but unfortunately it's quite slow in IE 7 when there is a fairly large amount of HTML (about 12 seconds on a page that contains 2 select lists with several hundred options each). I had assumed that the ":first" qualifier would cause the search operation to stop after it finds a match, but that doesn't seem to be the case. And the problem doesn't seem to be with any of the other
<span style="font-style: italic;">specific</span> qualifiers I'm using; "*:first" is equally slow.
I think I need to do this the long way, traversing the DOM and checking all the conditions manually, just so I can stop when a match is found. Unless anyone can think of a way I can accomplish this and still take advantage of jQuery's coolness in some way?
Thanks in advance,
Todd
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/