diff --git a/docs/html/search.jd b/docs/html/search.jd index 8032b22191675..d0e7478b51eb7 100644 --- a/docs/html/search.jd +++ b/docs/html/search.jd @@ -70,8 +70,8 @@ page.title=Search Results searchControl.setSearchStartingCallback(this, function(control, searcher, query) { // save the tab index from the hash tabIndex = location.hash.split("&t=")[1]; - - $("#searchTitle").html("search results for " + query + ""); + + $("#searchTitle").html("search results for " + escapeHTML(query) + ""); $.history.add('q=' + query + '&t=' + tabIndex); openTab(); }); @@ -96,7 +96,8 @@ page.title=Search Results $(window).history(function(e, hash) { var query = decodeURI(getQuery(hash)); searchControl.execute(query); - $("#searchTitle").html("search results for " + query + ""); + + $("#searchTitle").html("search results for " + escapeHTML(query) + ""); }); // forcefully regain key-up event control (previously jacked by search api) @@ -131,6 +132,13 @@ page.title=Search Results return queryParts[1]; } + /* returns the given string with all HTML brackets converted to entities + TODO: move this to the site's JS library */ + function escapeHTML(string) { + return string.replace(//g,">"); + } +