File tree 1 file changed +3
-12
lines changed
src/librustdoc/html/static/js
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,8 @@ function createSrcSidebar() {
131
131
}
132
132
}
133
133
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 + ) ) ? $ / ) ;
140
136
if ( ! match ) {
141
137
return ;
142
138
}
@@ -218,12 +214,7 @@ const handleSrcHighlight = (function() {
218
214
} ;
219
215
} ( ) ) ;
220
216
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 ) ;
227
218
228
219
onEachLazy ( document . getElementsByClassName ( "src-line-numbers" ) , el => {
229
220
el . addEventListener ( "click" , handleSrcHighlight ) ;
You can’t perform that action at this time.
0 commit comments