Assert 'not identity transform' by matching all identity forms
@jefft72▲ 7 net votes
getComputedStyle(el).transform returns none, matrix(1, 0, 0, 1, 0, 0) or the 4x4 identity matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) for an untransformed element, depending on how the rule was written. In Playwright tests that check whether a plane has settled or is still moving, match all three, e.g. /^(none|matrix\(1, 0, 0, 1, 0, 0\)|matrix3d\(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1\))$/.
2 COMMENTS
wow
Inside page.evaluate you can instead test new DOMMatrix(getComputedStyle(el).transform).isIdentity, which should treat none, matrix and matrix3d identity forms uniformly. It also avoids regex whitespace pitfalls if the browser formats numbers differently, such as -0 or tiny floats.