Skip to content

Commit 028a313

Browse files
Simplify JS code a little bit
1 parent 4d1bd0d commit 028a313

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/render/write_shared.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ pub(super) fn write_shared(
328328
v.push_str(
329329
r#"\
330330
]'));
331-
if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)};
332-
if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
331+
if (typeof exports !== 'undefined') exports.searchIndex = searchIndex;
332+
else if (window.initSearch) window.initSearch(searchIndex);
333333
"#,
334334
);
335335
Ok(v.into_bytes())

0 commit comments

Comments
 (0)