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) {
162
162
var i , from , to , match = window . location . hash . match ( / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ) ;
163
163
if ( match ) {
164
164
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
+ }
167
174
elem = document . getElementById ( from ) ;
168
175
if ( ! elem ) {
169
176
return ;
@@ -180,7 +187,11 @@ if (!DOMTokenList.prototype.remove) {
180
187
} ) ;
181
188
} ) ;
182
189
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" ) ;
184
195
}
185
196
} else if ( ev !== null && search && ! hasClass ( search , "hidden" ) && ev . newURL ) {
186
197
addClass ( search , "hidden" ) ;
You can’t perform that action at this time.
0 commit comments