Index: chrome/common/extensions/docs/js/sample_search.js |
diff --git a/chrome/common/extensions/docs/js/sample_search.js b/chrome/common/extensions/docs/js/sample_search.js |
index 3b950947147ab4f39b77bb5677e77b6f8572b396..5d8737bdf4c963637170235eaf1d1089da91bd11 100644 |
--- a/chrome/common/extensions/docs/js/sample_search.js |
+++ b/chrome/common/extensions/docs/js/sample_search.js |
@@ -25,6 +25,7 @@ function filterSamples() { |
return; |
} else { |
currentfilter = searchtext; |
+ window.location.hash = searchinput.value; |
} |
noresults.style.display = 'none'; |
@@ -77,7 +78,13 @@ function initSearch() { |
} |
if (window.location.hash.length > 1) { |
- setFilter(window.location.hash.substring(1)); |
+ var hash = window.location.hash.substring(1); |
+ var elem = document.getElementById(hash); |
+ if (elem) { |
+ elem.scrollIntoView(); |
+ } else { |
+ setFilter(hash); |
+ } |
} |
}; |