Modify ↓
Opened 21 years ago
Closed 21 years ago
#490 closed defect (fixed)
Highlighting search results doesnt work with konqueror
Reported by: | vittorio | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | search system | Version: | 0.7 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
searchHighlight() doesnt get executed with konqueror (tried with 3.2.2). it gets executed if i move
<script src="<?cs var:$htdocs_location ?>trac.js" type="text/javascript"></script>
from <head> to <body>
but searchHighlight() crashes then because it recurses endless. it doesnt if i comment
node.parentNode.insertBefore(span, newNode);
Attachments (0)
Change History (6)
comment:1 by , 21 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Version: | devel → 0.7 |
comment:2 by , 21 years ago
comment:4 by , 21 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
As posted by vittori on TracIrc:
theres still an issue with konq when i click on a searchresult, i get "Type Error: Null value" on if (pos >= 0 && !node.parentNode.className.match(/^searchword\d/)) {
comment:5 by , 21 years ago
Vittorio, can you please try this:
Index: htdocs/trac.js =================================================================== --- htdocs/trac.js (revision 682) +++ htdocs/trac.js (working copy) @@ -41,12 +41,13 @@ return []; } + var classNameRE = /\bsearchword\d\b/; function highlightWord(node, word, searchwordindex) { // If this node is a text node and contains the search word, highlight it by // surrounding it with a span element if (node.nodeType == 3) { // Node.TEXT_NODE var pos = node.nodeValue.toLowerCase().indexOf(word.toLowerCase()); - if (pos >= 0 && !node.parentNode.className.match(/^searchword\d/)) { + if (pos >= 0 && !classNameRE.test(node.parentNode.className)) { var span = document.createElement("span"); span.className = "searchword" + (searchwordindex % 5); span.appendChild(document.createTextNode(
Note:
See TracTickets
for help on using tickets.
I currently have no access to Konqueror. Can you please try the following patch and see whether that helps?