File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -162,8 +162,15 @@ if (!DOMTokenList.prototype.remove) {
162162 var i , from , to , match = window . location . hash . match ( / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ) ;
163163 if ( match ) {
164164 from = parseInt ( match [ 1 ] , 10 ) ;
165- to = Math . min ( 50000 , parseInt ( match [ 2 ] || match [ 1 ] , 10 ) ) ;
166- from = Math . min ( from , to ) ;
165+ to = from ;
166+ if ( typeof match [ 2 ] !== "undefined" ) {
167+ to = parseInt ( match [ 2 ] , 10 ) ;
168+ }
169+ if ( to < from ) {
170+ var tmp = to ;
171+ to = from ;
172+ from = tmp ;
173+ }
167174 elem = document . getElementById ( from ) ;
168175 if ( ! elem ) {
169176 return ;
@@ -180,7 +187,11 @@ if (!DOMTokenList.prototype.remove) {
180187 } ) ;
181188 } ) ;
182189 for ( i = from ; i <= to ; ++ i ) {
183- addClass ( document . getElementById ( i ) , "line-highlighted" ) ;
190+ elem = document . getElementById ( i ) ;
191+ if ( ! elem ) {
192+ break ;
193+ }
194+ addClass ( elem , "line-highlighted" ) ;
184195 }
185196 } else if ( ev !== null && search && ! hasClass ( search , "hidden" ) && ev . newURL ) {
186197 addClass ( search , "hidden" ) ;
You can’t perform that action at this time.
0 commit comments