@@ -82,8 +82,6 @@ if (!DOMTokenList.prototype.remove) {
82
82
"attr" ,
83
83
"derive" ] ;
84
84
85
- var start = Date . now ( ) ;
86
-
87
85
var search_input = document . getElementsByClassName ( "search-input" ) [ 0 ] ;
88
86
89
87
// On the search screen, so you remain on the last tab you opened.
@@ -148,7 +146,7 @@ if (!DOMTokenList.prototype.remove) {
148
146
var TY_PRIMITIVE = itemTypes . indexOf ( "primitive" ) ;
149
147
var TY_KEYWORD = itemTypes . indexOf ( "keyword" ) ;
150
148
151
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "js-only" ) ) , function ( e ) {
149
+ onEachLazy ( document . getElementsByClassName ( "js-only" ) , function ( e ) {
152
150
removeClass ( e , "js-only" ) ;
153
151
} ) ;
154
152
@@ -190,9 +188,8 @@ if (!DOMTokenList.prototype.remove) {
190
188
x . scrollIntoView ( ) ;
191
189
}
192
190
}
193
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "line-numbers" ) ) ,
194
- function ( e ) {
195
- onEach ( Array . prototype . slice . call ( e . getElementsByTagName ( "span" ) ) , function ( i_e ) {
191
+ onEachLazy ( document . getElementsByClassName ( "line-numbers" ) , function ( e ) {
192
+ onEachLazy ( e . getElementsByTagName ( "span" ) , function ( i_e ) {
196
193
removeClass ( i_e , "line-highlighted" ) ;
197
194
} ) ;
198
195
} ) ;
@@ -1103,7 +1100,7 @@ if (!DOMTokenList.prototype.remove) {
1103
1100
aliases [ i ] . displayPath = pathSplitter ( res [ 0 ] ) ;
1104
1101
aliases [ i ] . fullPath = aliases [ i ] . displayPath + aliases [ i ] . name ;
1105
1102
aliases [ i ] . href = res [ 1 ] ;
1106
- retothers . unshift ( aliases [ i ] ) ;
1103
+ ret . others . unshift ( aliases [ i ] ) ;
1107
1104
if ( ret . others . length > MAX_RESULTS ) {
1108
1105
ret . others . pop ( ) ;
1109
1106
}
@@ -1192,16 +1189,16 @@ if (!DOMTokenList.prototype.remove) {
1192
1189
}
1193
1190
clearTimeout ( hoverTimeout ) ;
1194
1191
hoverTimeout = setTimeout ( function ( ) {
1195
- onEach ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1196
- onEach ( e . getElementsByClassName ( "result" ) , function ( i_e ) {
1192
+ onEachLazy ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1193
+ onEachLazy ( e . getElementsByClassName ( "result" ) , function ( i_e ) {
1197
1194
removeClass ( i_e , "highlighted" ) ;
1198
1195
} ) ;
1199
1196
} ) ;
1200
1197
addClass ( el , "highlighted" ) ;
1201
1198
} , 20 ) ;
1202
1199
} ;
1203
- onEach ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1204
- onEach ( e . getElementsByClassName ( "result" ) , function ( i_e ) {
1200
+ onEachLazy ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1201
+ onEachLazy ( e . getElementsByClassName ( "result" ) , function ( i_e ) {
1205
1202
i_e . onclick = click_func ;
1206
1203
i_e . onmouseover = mouseover_func ;
1207
1204
} ) ;
@@ -1213,8 +1210,8 @@ if (!DOMTokenList.prototype.remove) {
1213
1210
var actives = [ [ ] , [ ] , [ ] ] ;
1214
1211
// "current" is used to know which tab we're looking into.
1215
1212
var current = 0 ;
1216
- onEach ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1217
- onEach ( e . getElementsByClassName ( "highlighted" ) , function ( e ) {
1213
+ onEachLazy ( document . getElementsByClassName ( "search-results" ) , function ( e ) {
1214
+ onEachLazy ( e . getElementsByClassName ( "highlighted" ) , function ( e ) {
1218
1215
actives [ current ] . push ( e ) ;
1219
1216
} ) ;
1220
1217
current += 1 ;
@@ -1418,7 +1415,7 @@ if (!DOMTokenList.prototype.remove) {
1418
1415
td_width = tds [ 0 ] . offsetWidth ;
1419
1416
}
1420
1417
var width = search . offsetWidth - 40 - td_width ;
1421
- onEach ( Array . prototype . slice . call ( search . getElementsByClassName ( "desc" ) ) , function ( e ) {
1418
+ onEachLazy ( search . getElementsByClassName ( "desc" ) , function ( e ) {
1422
1419
e . style . width = width + "px" ;
1423
1420
} ) ;
1424
1421
initSearchNav ( ) ;
@@ -1894,9 +1891,7 @@ if (!DOMTokenList.prototype.remove) {
1894
1891
} ) ;
1895
1892
innerToggle . title = "collapse all docs" ;
1896
1893
if ( fromAutoCollapse !== true ) {
1897
- onEach ( Array . prototype . slice . call (
1898
- document . getElementsByClassName ( "collapse-toggle" ) ) ,
1899
- function ( e ) {
1894
+ onEachLazy ( document . getElementsByClassName ( "collapse-toggle" ) , function ( e ) {
1900
1895
collapseDocs ( e , "show" ) ;
1901
1896
} ) ;
1902
1897
}
@@ -1908,9 +1903,7 @@ if (!DOMTokenList.prototype.remove) {
1908
1903
} ) ;
1909
1904
innerToggle . title = "expand all docs" ;
1910
1905
if ( fromAutoCollapse !== true ) {
1911
- onEach ( Array . prototype . slice . call (
1912
- document . getElementsByClassName ( "collapse-toggle" ) ) ,
1913
- function ( e ) {
1906
+ onEachLazy ( document . getElementsByClassName ( "collapse-toggle" ) , function ( e ) {
1914
1907
collapseDocs ( e , "hide" , pageId ) ;
1915
1908
} ) ;
1916
1909
}
@@ -1984,12 +1977,12 @@ if (!DOMTokenList.prototype.remove) {
1984
1977
}
1985
1978
if ( action === "hide" ) {
1986
1979
addClass ( relatedDoc , "hidden-by-usual-hider" ) ;
1987
- onEach ( Array . prototype . slice . call ( toggle . childNodes ) , adjustToggle ( true ) ) ;
1980
+ onEachLazy ( toggle . childNodes , adjustToggle ( true ) ) ;
1988
1981
addClass ( toggle . parentNode , "collapsed" ) ;
1989
1982
} else if ( action === "show" ) {
1990
1983
removeClass ( relatedDoc , "hidden-by-usual-hider" ) ;
1991
1984
removeClass ( toggle . parentNode , "collapsed" ) ;
1992
- onEach ( Array . prototype . slice . call ( toggle . childNodes ) , adjustToggle ( false ) ) ;
1985
+ onEachLazy ( toggle . childNodes , adjustToggle ( false ) ) ;
1993
1986
}
1994
1987
}
1995
1988
} else {
@@ -2022,13 +2015,13 @@ if (!DOMTokenList.prototype.remove) {
2022
2015
if ( action === "show" ) {
2023
2016
removeClass ( relatedDoc , "fns-now-collapsed" ) ;
2024
2017
removeClass ( docblock , "hidden-by-usual-hider" ) ;
2025
- onEach ( Array . prototype . slice . call ( toggle . childNodes ) , adjustToggle ( false ) ) ;
2026
- onEach ( Array . prototype . slice . call ( relatedDoc . childNodes ) , implHider ( false ) ) ;
2018
+ onEachLazy ( toggle . childNodes , adjustToggle ( false ) ) ;
2019
+ onEachLazy ( relatedDoc . childNodes , implHider ( false ) ) ;
2027
2020
} else if ( action === "hide" ) {
2028
2021
addClass ( relatedDoc , "fns-now-collapsed" ) ;
2029
2022
addClass ( docblock , "hidden-by-usual-hider" ) ;
2030
- onEach ( Array . prototype . slice . call ( toggle . childNodes ) , adjustToggle ( true ) ) ;
2031
- onEach ( Array . prototype . slice . call ( relatedDoc . childNodes ) , implHider ( true ) ) ;
2023
+ onEachLazy ( toggle . childNodes , adjustToggle ( true ) ) ;
2024
+ onEachLazy ( relatedDoc . childNodes , implHider ( true ) ) ;
2032
2025
}
2033
2026
}
2034
2027
}
@@ -2052,9 +2045,7 @@ if (!DOMTokenList.prototype.remove) {
2052
2045
var impl_list = document . getElementById ( "implementations-list" ) ;
2053
2046
2054
2047
if ( impl_list !== null ) {
2055
- onEach ( Array . prototype . slice . call (
2056
- impl_list . getElementsByClassName ( "collapse-toggle" ) ) ,
2057
- collapser ) ;
2048
+ onEachLazy ( impl_list . getElementsByClassName ( "collapse-toggle" ) , collapser ) ;
2058
2049
}
2059
2050
}
2060
2051
}
@@ -2104,9 +2095,9 @@ if (!DOMTokenList.prototype.remove) {
2104
2095
}
2105
2096
} ;
2106
2097
2107
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "method" ) ) , func ) ;
2108
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "associatedconstant" ) ) , func ) ;
2109
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "impl" ) ) , funcImpl ) ;
2098
+ onEachLazy ( document . getElementsByClassName ( "method" ) , func ) ;
2099
+ onEachLazy ( document . getElementsByClassName ( "associatedconstant" ) , func ) ;
2100
+ onEachLazy ( document . getElementsByClassName ( "impl" ) , funcImpl ) ;
2110
2101
var impl_call = function ( ) { } ;
2111
2102
if ( getCurrentValue ( "rustdoc-method-docs" ) !== "false" ) {
2112
2103
impl_call = function ( e , newToggle , pageId ) {
@@ -2127,8 +2118,7 @@ if (!DOMTokenList.prototype.remove) {
2127
2118
function toggleClicked ( ) {
2128
2119
if ( hasClass ( this , "collapsed" ) ) {
2129
2120
removeClass ( this , "collapsed" ) ;
2130
- onEach ( Array . prototype . slice . call ( this . parentNode . getElementsByClassName ( "hidden" ) ) ,
2131
- function ( x ) {
2121
+ onEachLazy ( this . parentNode . getElementsByClassName ( "hidden" ) , function ( x ) {
2132
2122
if ( hasClass ( x , "content" ) === false ) {
2133
2123
removeClass ( x , "hidden" ) ;
2134
2124
addClass ( x , "x" ) ;
@@ -2138,8 +2128,7 @@ if (!DOMTokenList.prototype.remove) {
2138
2128
"</span>] Hide undocumented items" ;
2139
2129
} else {
2140
2130
addClass ( this , "collapsed" ) ;
2141
- onEach ( Array . prototype . slice . call ( this . parentNode . getElementsByClassName ( "x" ) ) ,
2142
- function ( x ) {
2131
+ onEachLazy ( this . parentNode . getElementsByClassName ( "x" ) , function ( x ) {
2143
2132
if ( hasClass ( x , "content" ) === false ) {
2144
2133
addClass ( x , "hidden" ) ;
2145
2134
removeClass ( x , "x" ) ;
@@ -2149,8 +2138,8 @@ if (!DOMTokenList.prototype.remove) {
2149
2138
"</span>] Show hidden undocumented items" ;
2150
2139
}
2151
2140
}
2152
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "impl-items" ) ) , function ( e ) {
2153
- onEach ( Array . prototype . slice . call ( e . getElementsByClassName ( "associatedconstant" ) ) , func ) ;
2141
+ onEachLazy ( document . getElementsByClassName ( "impl-items" ) , function ( e ) {
2142
+ onEachLazy ( e . getElementsByClassName ( "associatedconstant" ) , func ) ;
2154
2143
var hiddenElems = e . getElementsByClassName ( "hidden" ) ;
2155
2144
var needToggle = false ;
2156
2145
@@ -2215,13 +2204,10 @@ if (!DOMTokenList.prototype.remove) {
2215
2204
2216
2205
e . style . display = "none" ;
2217
2206
addClass ( wrap , "collapsed" ) ;
2218
- onEach ( Array . prototype . slice . call ( inner_toggle . getElementsByClassName ( "inner" ) ) ,
2219
- function ( e ) {
2207
+ onEachLazy ( inner_toggle . getElementsByClassName ( "inner" ) , function ( e ) {
2220
2208
e . innerHTML = labelForToggleButton ( true ) ;
2221
2209
} ) ;
2222
- onEach ( Array . prototype . slice . call (
2223
- inner_toggle . getElementsByClassName ( "toggle-label" ) ) ,
2224
- function ( e ) {
2210
+ onEachLazy ( inner_toggle . getElementsByClassName ( "toggle-label" ) , function ( e ) {
2225
2211
e . style . display = "inline-block" ;
2226
2212
if ( extra === true ) {
2227
2213
i_e . innerHTML = " Show " + e . childNodes [ 0 ] . innerHTML ;
@@ -2268,28 +2254,24 @@ if (!DOMTokenList.prototype.remove) {
2268
2254
}
2269
2255
}
2270
2256
2271
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "docblock" ) ) ,
2272
- buildToggleWrapper ) ;
2273
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "sub-variant" ) ) ,
2274
- buildToggleWrapper ) ;
2257
+ onEachLazy ( document . getElementsByClassName ( "docblock" ) , buildToggleWrapper ) ;
2258
+ onEachLazy ( document . getElementsByClassName ( "sub-variant" ) , buildToggleWrapper ) ;
2275
2259
2276
2260
// In the search display, allows to switch between tabs.
2277
2261
function printTab ( nb ) {
2278
2262
if ( nb === 0 || nb === 1 || nb === 2 ) {
2279
2263
currentTab = nb ;
2280
2264
}
2281
2265
var nb_copy = nb ;
2282
- onEach ( Array . prototype . slice . call ( document . getElementById ( "titles" ) . childNodes ) ,
2283
- function ( elem ) {
2266
+ onEachLazy ( document . getElementById ( "titles" ) . childNodes , function ( elem ) {
2284
2267
if ( nb_copy === 0 ) {
2285
2268
addClass ( elem , "selected" ) ;
2286
2269
} else {
2287
2270
removeClass ( elem , "selected" ) ;
2288
2271
}
2289
2272
nb_copy -= 1 ;
2290
2273
} ) ;
2291
- onEach ( Array . prototype . slice . call ( document . getElementById ( "results" ) . childNodes ) ,
2292
- function ( elem ) {
2274
+ onEachLazy ( document . getElementById ( "results" ) . childNodes , function ( elem ) {
2293
2275
if ( nb === 0 ) {
2294
2276
elem . style . display = "" ;
2295
2277
} else {
@@ -2320,7 +2302,7 @@ if (!DOMTokenList.prototype.remove) {
2320
2302
} ;
2321
2303
}
2322
2304
var attributesToggle = createToggleWrapper ( createSimpleToggle ( false ) ) ;
2323
- onEach ( Array . prototype . slice . call ( main . getElementsByClassName ( "attributes" ) ) , function ( i_e ) {
2305
+ onEachLazy ( main . getElementsByClassName ( "attributes" ) , function ( i_e ) {
2324
2306
i_e . parentNode . insertBefore ( attributesToggle . cloneNode ( true ) , i_e ) ;
2325
2307
itemAttributesFunc ( i_e ) ;
2326
2308
} ) ;
@@ -2340,8 +2322,7 @@ if (!DOMTokenList.prototype.remove) {
2340
2322
x . parentNode . insertBefore ( node , x ) ;
2341
2323
} ;
2342
2324
}
2343
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "rust-example-rendered" ) ) ,
2344
- function ( e ) {
2325
+ onEachLazy ( document . getElementsByClassName ( "rust-example-rendered" ) , function ( e ) {
2345
2326
if ( hasClass ( e , "compile_fail" ) ) {
2346
2327
e . addEventListener ( "mouseover" , function ( event ) {
2347
2328
this . parentElement . previousElementSibling . childNodes [ 0 ] . style . color = "#f00" ;
@@ -2379,8 +2360,7 @@ if (!DOMTokenList.prototype.remove) {
2379
2360
}
2380
2361
}
2381
2362
2382
- onEach ( Array . prototype . slice . call ( document . getElementsByClassName ( "important-traits" ) ) ,
2383
- function ( e ) {
2363
+ onEachLazy ( document . getElementsByClassName ( "important-traits" ) , function ( e ) {
2384
2364
e . onclick = function ( ) {
2385
2365
showModal ( e . lastElementChild . innerHTML ) ;
2386
2366
} ;
@@ -2435,7 +2415,7 @@ if (!DOMTokenList.prototype.remove) {
2435
2415
}
2436
2416
2437
2417
if ( main ) {
2438
- onEach ( Array . prototype . slice . call ( main . childNodes ) , function ( e ) {
2418
+ onEachLazy ( main . childNodes , function ( e ) {
2439
2419
if ( e . tagName === "H2" || e . tagName === "H3" ) {
2440
2420
e . nextElementSibling . style . display = "block" ;
2441
2421
}
0 commit comments