File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 122122 }
123123
124124 function highlightSourceLines ( ev ) {
125+ var search = document . getElementById ( "search" ) ;
125126 var i , from , to , match = window . location . hash . match ( / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ) ;
126127 if ( match ) {
127128 from = parseInt ( match [ 1 ] , 10 ) ;
145146 for ( i = from ; i <= to ; ++ i ) {
146147 addClass ( document . getElementById ( i ) , 'line-highlighted' ) ;
147148 }
149+ } else if ( ev !== null && search && ! hasClass ( search , "hidden" ) && ev . newURL ) {
150+ addClass ( search , "hidden" ) ;
151+ removeClass ( document . getElementById ( "main" ) , "hidden" ) ;
152+ var hash = ev . newURL . slice ( ev . newURL . indexOf ( '#' ) + 1 ) ;
153+ var elem = document . getElementById ( hash ) ;
154+ if ( elem ) {
155+ elem . scrollIntoView ( ) ;
156+ }
148157 }
149158 }
150159 highlightSourceLines ( null ) ;
You can’t perform that action at this time.
0 commit comments