I apologise. This is not an ajaxSearch bug and ajaxSearch is not inserting spans in (x)html attributes. I use a bbcode plugin that replaces markup like this:
on all pages by (x)html markup. This plugin was working on the code AFTER ajaxSearch had formatted the search results, causing the problem.
The simplest solution for me is to prevent the bbcode plugin from running on the search results page, which I have done and this works. I notice that I might be able to reapply my bbcode function using the stripOutput ajaxSearch snippet parameter if I want to keep the bbcode working. Ultimately, it tells me that I should be improving the quality and security of my bbcode plugin by ensuring any tags are stripped from the attributes.
Cheers.