From 96f0116a27b91563ac367345ee84d1ee54ef459c Mon Sep 17 00:00:00 2001 From: Cyril Fluck Date: Fri, 10 Jan 2025 14:04:37 -0800 Subject: [PATCH] bug: Support when border-spacing returns a single value This is mostly a workaround for a [potential bug introduced with Firefox 134](https://bugzilla.mozilla.org/show_bug.cgi?id=1941066) Based on the spec, `getComputedStyle(el).borderSpacing` should always return 2 values, even when they are identical. On Firefox 134, it returns a single value when they are the same. --- addon/src/utils/css-calculation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addon/src/utils/css-calculation.ts b/addon/src/utils/css-calculation.ts index eab8e19b..a31a7946 100644 --- a/addon/src/utils/css-calculation.ts +++ b/addon/src/utils/css-calculation.ts @@ -8,7 +8,9 @@ */ export function getBorderSpacing(el: Element) { const css = getComputedStyle(el).borderSpacing; // '0px 0px' - const [horizontal, vertical] = css.split(' '); + + const [horizontal, initialVertical] = css.split(' '); + const vertical = initialVertical === undefined ? horizontal : initialVertical; return { horizontal: parseFloat(horizontal ?? ''),