Did you consider using the jQuery `:contains` selector here? I'm not sure if it is any faster than this code, but it would be fewer lines :-)