Skip to content

Commit 7834aeb

Browse files
committed
Add comments regarding object shapes in buildIndex
1 parent b7d14b1 commit 7834aeb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/librustdoc/html/static/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,9 @@ function defocusSearchBar() {
18521852
var crateSize = 0;
18531853

18541854
searchWords.push(crate);
1855+
// This object should have exactly the same set of fields as the "row"
1856+
// object defined below. Your JavaScript runtime will thank you.
1857+
// https://mathiasbynens.be/notes/shapes-ics
18551858
var crateRow = {
18561859
crate: crate,
18571860
ty: 1, // == ExternCrate
@@ -1902,6 +1905,8 @@ function defocusSearchBar() {
19021905
len = itemTypes.length;
19031906
var lastPath = "";
19041907
for (i = 0; i < len; ++i) {
1908+
// This object should have exactly the same set of fields as the "crateRow"
1909+
// object defined above.
19051910
var row = {
19061911
crate: crate,
19071912
ty: itemTypes[i],

0 commit comments

Comments
 (0)