Bug 20501: Don't cut strings when unhighlighting in intranet search results

When you click Unhighlight on the search results of a search in the staff client
when the search terms contain the same word twice, like "ma ma", the highlighted
words disappear, and don't reappear if you click Highlight.

This patch makes the same change to the intranet copy of jquery.highlight-3.js that
bug 5844 made to the OPAC copy.

Test plan:
1) Without this patch, search in the intranet for ma ma and verify you have at least
   two matching records.
2) Notice that the Ma in Material type: Book is highlighted.
3) Click Unhighlight, and notice that it has become terial type: Book
4) Apply this patch, repeat the search with a shift+reload to reload the .js
5) Click Unhighlight, and verify that Material type: Book remains Material

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 5810b72af9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Phil Ringnalda 2020-04-19 02:37:49 +00:00 committed by Lucas Gass
parent 896f4bcf24
commit fbcc0b71d5
1 changed files with 2 additions and 6 deletions

View File

@ -44,10 +44,6 @@ jQuery.fn.highlight = function(pat) {
jQuery.fn.removeHighlight = function() {
return this.find("span.term").each(function() {
this.parentNode.firstChild.nodeName;
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
}).end();
$(this).contents().unwrap();
});
};