@@ -607,6 +607,12 @@ function createResults(resultsPath) {
607607 elem . setAttribute ( 'className' , attr ) ;
608608 }
609609
610+ const decodeHtml = ( html ) => {
611+ const txt = document . createElement ( "textarea" ) ;
612+ txt . innerHTML = html ;
613+ return txt . value ;
614+ } ;
615+
610616 const results = document . getElementById ( "SRResults" ) ;
611617 results . innerHTML = '' ;
612618 searchData . forEach ( ( elem , index ) => {
@@ -620,7 +626,7 @@ function createResults(resultsPath) {
620626 srLink . setAttribute ( 'id' , 'Item' + index ) ;
621627 setKeyActions ( srLink , 'return searchResults.Nav(event,' + index + ')' ) ;
622628 setClassAttr ( srLink , 'SRSymbol' ) ;
623- srLink . innerHTML = elem [ 1 ] [ 0 ] ;
629+ srLink . innerHTML = decodeHtml ( elem [ 1 ] [ 0 ] ) ;
624630 srEntry . appendChild ( srLink ) ;
625631 if ( elem [ 1 ] . length == 2 ) { // single result
626632 if ( elem [ 1 ] [ 1 ] [ 0 ] . startsWith ( 'http://' ) || elem [ 1 ] [ 1 ] [ 0 ] . startsWith ( 'https://' ) ) { // absolute path
@@ -636,7 +642,7 @@ function createResults(resultsPath) {
636642 }
637643 const srScope = document . createElement ( 'span' ) ;
638644 setClassAttr ( srScope , 'SRScope' ) ;
639- srScope . innerHTML = elem [ 1 ] [ 1 ] [ 2 ] ;
645+ srScope . innerHTML = decodeHtml ( elem [ 1 ] [ 1 ] [ 2 ] ) ;
640646 srEntry . appendChild ( srScope ) ;
641647 } else { // multiple results
642648 srLink . setAttribute ( 'href' , 'javascript:searchResults.Toggle("SR_' + id + '")' ) ;
@@ -658,7 +664,7 @@ function createResults(resultsPath) {
658664 } else {
659665 srChild . setAttribute ( 'target' , '_blank' ) ;
660666 }
661- srChild . innerHTML = elem [ 1 ] [ c + 1 ] [ 2 ] ;
667+ srChild . innerHTML = decodeHtml ( elem [ 1 ] [ c + 1 ] [ 2 ] ) ;
662668 srChildren . appendChild ( srChild ) ;
663669 }
664670 srEntry . appendChild ( srChildren ) ;
0 commit comments