Skip to content

Commit 1f25c8b

Browse files
committed
auto merge of #13895 : adrientetar/rust/js-escape, r=alexcrichton
See #13884 for the details. Closes #13884. r? @alexcrichton
2 parents afed55b + 5f0a426 commit 1f25c8b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustdoc/html/static/main.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,16 @@
386386
});
387387
}
388388

389+
function escape(content) {
390+
return $('<h1/>').text(content).html();
391+
}
392+
389393
function showResults(results) {
390394
var output, shown, query = getQuery();
391395

392396
currentResults = query.id;
393-
output = '<h1>Results for ' + query.query +
394-
(query.type ? ' (type: ' + query.type + ')' : '') + '</h1>';
397+
output = '<h1>Results for ' + escape(query.query) +
398+
(query.type ? ' (type: ' + escape(query.type) + ')' : '') + '</h1>';
395399
output += '<table class="search-results">';
396400

397401
if (results.length > 0) {
@@ -650,4 +654,3 @@
650654

651655
window.initSearch = initSearch;
652656
}());
653-

0 commit comments

Comments
 (0)