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

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 c4e04e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/src/utils/css-calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
*/
export function getBorderSpacing(el: Element) {
const css = getComputedStyle(el).borderSpacing; // '0px 0px'
const [horizontal, vertical] = css.split(' ');

let [horizontal, vertical] = css.split(' ');
if (vertical === undefined) {
vertical = horizontal;
}

return {
horizontal: parseFloat(horizontal ?? ''),
Expand Down

0 comments on commit c4e04e9

Please sign in to comment.