File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,8 @@ function createSrcSidebar() {
131131 }
132132}
133133
134- const lineNumbersRegex = / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ;
135-
136- function highlightSrcLines ( match ) {
137- if ( typeof match === "undefined" ) {
138- match = window . location . hash . match ( lineNumbersRegex ) ;
139- }
134+ function highlightSrcLines ( ) {
135+ const match = window . location . hash . match ( / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ) ;
140136 if ( ! match ) {
141137 return ;
142138 }
@@ -218,12 +214,7 @@ const handleSrcHighlight = (function() {
218214 } ;
219215} ( ) ) ;
220216
221- window . addEventListener ( "hashchange" , ( ) => {
222- const match = window . location . hash . match ( lineNumbersRegex ) ;
223- if ( match ) {
224- return highlightSrcLines ( match ) ;
225- }
226- } ) ;
217+ window . addEventListener ( "hashchange" , highlightSrcLines ) ;
227218
228219onEachLazy ( document . getElementsByClassName ( "src-line-numbers" ) , el => {
229220 el . addEventListener ( "click" , handleSrcHighlight ) ;
You can’t perform that action at this time.
0 commit comments