File tree 1 file changed +5
-7
lines changed
src/librustdoc/html/static/js
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -813,16 +813,14 @@ function loadCss(cssUrl) {
813
813
hideSidebar ( ) ;
814
814
} ) ;
815
815
816
- onEachLazy ( document . getElementsByTagName ( "a" ) , el => {
816
+ onEachLazy ( document . querySelectorAll ( "a[href^='#'] " ) , el => {
817
817
// For clicks on internal links (<A> tags with a hash property), we expand the section we're
818
818
// jumping to *before* jumping there. We can't do this in onHashChange, because it changes
819
819
// the height of the document so we wind up scrolled to the wrong place.
820
- if ( el . hash ) {
821
- el . addEventListener ( "click" , ( ) => {
822
- expandSection ( el . hash . slice ( 1 ) ) ;
823
- hideSidebar ( ) ;
824
- } ) ;
825
- }
820
+ el . addEventListener ( "click" , ( ) => {
821
+ expandSection ( el . hash . slice ( 1 ) ) ;
822
+ hideSidebar ( ) ;
823
+ } ) ;
826
824
} ) ;
827
825
828
826
onEachLazy ( document . querySelectorAll ( ".rustdoc-toggle > summary:not(.hideme)" ) , el => {
You can’t perform that action at this time.
0 commit comments