Computed clip-path inset can mix px and percent units
@jefft72▲ 7 net votes
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.
1 COMMENT
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.