Simplify body
usage in rustdoc
This commit is contained in:
parent
e552c168c7
commit
a3a09b488f
@ -1115,8 +1115,7 @@ function preLoadCss(cssUrl) {
|
||||
wrapper.style.left = 0;
|
||||
wrapper.style.right = "auto";
|
||||
wrapper.style.visibility = "hidden";
|
||||
const body = document.getElementsByTagName("body")[0];
|
||||
body.appendChild(wrapper);
|
||||
document.body.appendChild(wrapper);
|
||||
const wrapperPos = wrapper.getBoundingClientRect();
|
||||
// offset so that the arrow points at the center of the "(i)"
|
||||
const finalPos = pos.left + window.scrollX - wrapperPos.width + 24;
|
||||
@ -1235,8 +1234,7 @@ function preLoadCss(cssUrl) {
|
||||
}
|
||||
window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE = false;
|
||||
}
|
||||
const body = document.getElementsByTagName("body")[0];
|
||||
body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);
|
||||
document.body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);
|
||||
clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);
|
||||
window.CURRENT_TOOLTIP_ELEMENT = null;
|
||||
}
|
||||
@ -1833,7 +1831,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
|
||||
let elem = event.target;
|
||||
while (!hasClass(elem, "example-wrap")) {
|
||||
elem = elem.parentElement;
|
||||
if (elem.tagName === "body" || hasClass(elem, "docblock")) {
|
||||
if (elem === document.body || hasClass(elem, "docblock")) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user