(bug 17808) (bug 21167) use real links for search suggestions
Use real links for search suggestions. This allows the viewer to, for
example, open the search results in a new tab or right-click them
to copy link's address.
We hook up the result.render callback and wrap the entire container
element (.suggestions-results <div>) in an <a>. This is permitted in HTML5
and appears to work even on IE 6. (It has some quirks related to e.g.
backgrounds handling, but thankfully none of them apply here, as we just
need it to be properly clickable - see http://jsbin.com/ejurub/2 for
a minimal test.)
We do the same for the special.render callback, although it has to be
handled slightly differently due to inconsistencies in $.suggestions that
would require a rewrite to fix.
We have to do some pretty ugly mangling to determine the links' hrefs,
but well, that's life.
This required some changes to $.suggestions:
* pass the necessary data to the render callback
* do not interfere with clicks with a mouse button other than left
or with modifier keys active, to allow for the standard link behavior
described above
* adjusting the width of suggestions container and applying autoellipsis
should be done regardless of the render callback being used or not
* add some flexibility to $.suggestions.highlight, so it doesn't break
down when DOM is modified
Also did some good-to-have changes to $.suggestions:
* detect suggestions elements in various places by their classes, not by
them being <div>s
Change-Id: I87940ca86a2b3776969cbcee8cdf93e3c66b0cd9