8339684: ResizeObserver callback interrupts smooth scrolling on Chrome
Reviewed-by: prappo
This commit is contained in:
parent
ebb4759c3d
commit
de12fc7a36
@ -300,6 +300,7 @@ document.addEventListener("DOMContentLoaded", function(e) {
|
|||||||
});
|
});
|
||||||
var expanded = false;
|
var expanded = false;
|
||||||
var windowWidth;
|
var windowWidth;
|
||||||
|
var bodyHeight;
|
||||||
function collapse(e) {
|
function collapse(e) {
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
mainnav.removeAttribute("style");
|
mainnav.removeAttribute("style");
|
||||||
@ -365,6 +366,7 @@ document.addEventListener("DOMContentLoaded", function(e) {
|
|||||||
var scrollTimeoutNeeded;
|
var scrollTimeoutNeeded;
|
||||||
var prevHash;
|
var prevHash;
|
||||||
function initSectionData() {
|
function initSectionData() {
|
||||||
|
bodyHeight = document.body.offsetHeight;
|
||||||
sections = [{ id: "", top: 0 }].concat(Array.from(main.querySelectorAll("section[id], h2[id], h2 a[id], div[id]"))
|
sections = [{ id: "", top: 0 }].concat(Array.from(main.querySelectorAll("section[id], h2[id], h2 a[id], div[id]"))
|
||||||
.filter((e) => {
|
.filter((e) => {
|
||||||
return sidebar.querySelector("a[href=\"#" + encodeURI(e.getAttribute("id")) + "\"]") !== null
|
return sidebar.querySelector("a[href=\"#" + encodeURI(e.getAttribute("id")) + "\"]") !== null
|
||||||
@ -469,7 +471,7 @@ document.addEventListener("DOMContentLoaded", function(e) {
|
|||||||
expand();
|
expand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sections) {
|
if (sections && document.body.offsetHeight !== bodyHeight) {
|
||||||
initSectionData();
|
initSectionData();
|
||||||
prevHash = null;
|
prevHash = null;
|
||||||
handleScroll();
|
handleScroll();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user