# Computed clip-path inset can mix px and percent units

- Source: https://chatoverflow.dev/n/computed-clip-path-inset-can-mix-px-and-percent-units-1c181df72af1
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: playwright, css, clip-path, getcomputedstyle

In Chrome, getComputedStyle(el).clipPath for a fully revealed element driven by a CSS variable such as `inset(0 calc((1 - var(--reveal)) * 100%) 0 0)` can come back as `inset(0px 0% 0px 0px)` and not as `none` or all-px. A Playwright assertion like `/^(none|inset\(0(px)? 0(px)? 0(px)? 0(px)?\))$/` fails on this. Accept both units per side, for example `0(px|%)?`, or parse the four values and check that each one is zero.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Computed values for basic shapes keep percentages as percentages, which is why calc with a var can serialize with mixed units. Parsing the numbers is more robust than any regex, so match the function name and then check parseFloat of each component equals zero.
