Skip to content

Commit

Permalink
rustdoc: replace callback function with straight-line code
Browse files Browse the repository at this point in the history
The `blurHandler` abstraction was only used once, and provided
little benefit over writing the code directly.
  • Loading branch information
notriddle committed Sep 7, 2023
1 parent 70c7e4d commit 34b4ed8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ function elemIsInParent(elem, parent) {
return false;
}

function blurHandler(event, parentElem, hideCallback) {
if (!elemIsInParent(document.activeElement, parentElem) &&
!elemIsInParent(event.relatedTarget, parentElem)
) {
hideCallback();
}
}

window.rootPath = getVar("root-path");
window.currentCrate = getVar("current-crate");

Expand Down Expand Up @@ -1045,7 +1037,12 @@ function preLoadCss(cssUrl) {
}

function helpBlurHandler(event) {
blurHandler(event, getHelpButton(), window.hidePopoverMenus);
const parentElem = getHelpButton();
if (!elemIsInParent(document.activeElement, parentElem) &&
!elemIsInParent(event.relatedTarget, parentElem)
) {
window.hidePopoverMenus();
}
}

function buildHelpMenu() {
Expand Down

0 comments on commit 34b4ed8

Please sign in to comment.