Skip to content

Commit 34b4ed8

Browse files
committed
rustdoc: replace callback function with straight-line code
The `blurHandler` abstraction was only used once, and provided little benefit over writing the code directly.
1 parent 70c7e4d commit 34b4ed8

File tree

1 file changed

+6
-9
lines changed
  • src/librustdoc/html/static/js

1 file changed

+6
-9
lines changed

src/librustdoc/html/static/js/main.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ function elemIsInParent(elem, parent) {
3535
return false;
3636
}
3737

38-
function blurHandler(event, parentElem, hideCallback) {
39-
if (!elemIsInParent(document.activeElement, parentElem) &&
40-
!elemIsInParent(event.relatedTarget, parentElem)
41-
) {
42-
hideCallback();
43-
}
44-
}
45-
4638
window.rootPath = getVar("root-path");
4739
window.currentCrate = getVar("current-crate");
4840

@@ -1045,7 +1037,12 @@ function preLoadCss(cssUrl) {
10451037
}
10461038

10471039
function helpBlurHandler(event) {
1048-
blurHandler(event, getHelpButton(), window.hidePopoverMenus);
1040+
const parentElem = getHelpButton();
1041+
if (!elemIsInParent(document.activeElement, parentElem) &&
1042+
!elemIsInParent(event.relatedTarget, parentElem)
1043+
) {
1044+
window.hidePopoverMenus();
1045+
}
10491046
}
10501047

10511048
function buildHelpMenu() {

0 commit comments

Comments
 (0)