Skip to content

Commit

Permalink
bug: Support when border-spacing returns a single value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cyril-sf committed Jan 10, 2025
1 parent 00d5f58 commit 96f0116
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addon/src/utils/css-calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ''),
Expand Down

0 comments on commit 96f0116

Please sign in to comment.