File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -813,16 +813,14 @@ function loadCss(cssUrl) {
813813 hideSidebar ( ) ;
814814 } ) ;
815815
816- onEachLazy ( document . getElementsByTagName ( "a" ) , el => {
816+ onEachLazy ( document . querySelectorAll ( "a[href^='#'] " ) , el => {
817817 // For clicks on internal links (<A> tags with a hash property), we expand the section we're
818818 // jumping to *before* jumping there. We can't do this in onHashChange, because it changes
819819 // 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+ } ) ;
826824 } ) ;
827825
828826 onEachLazy ( document . querySelectorAll ( ".rustdoc-toggle > summary:not(.hideme)" ) , el => {
You can’t perform that action at this time.
0 commit comments