From 604a8caf3be8b22bd46c90fb4e634415e55a275f Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Tue, 2 May 2023 01:35:43 +0800 Subject: [PATCH] Fix ResizeObserver loop in some situations This is caused by 74863603908378d3bcffe5fce3307928793c4788. Not sure why it happens, and it only occurs in WebKit. Truncating the padding seems to be the fix. --- paginator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paginator.js b/paginator.js index 59815d0..dca9457 100644 --- a/paginator.js +++ b/paginator.js @@ -434,7 +434,7 @@ export class Paginator { const { width, height } = this.#container.getBoundingClientRect() const size = vertical ? height : width - const gap = gape * size + const gap = Math.trunc(gape * size) this.heads = null this.feet = null @@ -447,7 +447,7 @@ export class Paginator { this.#maxSizeContainer.style.maxWidth = `${maxColumns * maxColumnWidth}px` const { width, height } = this.#container.getBoundingClientRect() const size = vertical ? height : width - const gap = gape * size + const gap = Math.trunc(gape * size) const divisor = Math.ceil(size / maxColumnWidth) const columnWidth = (size / divisor) - gap this.#element.setAttribute('dir', rtl ? 'rtl' : 'ltr')