Skip to content

Commit 4be4622

Browse files
committed
fix: Illegal constructor
1 parent dacacce commit 4be4622

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/utils/initMatchers.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ chai.use((chaiAPI, utils) => {
104104
* @returns {CSSStyleDeclaration}
105105
*/
106106
function pretendVisibleGetComputedStyle(element) {
107-
const declaration = new CSSStyleDeclaration();
107+
// `CSSStyleDeclaration` is not constructable
108+
// https://stackoverflow.com/a/52732909/3406963
109+
// this is not equivalent to the declaration from `getComputedStyle`
110+
// e.g `getComputedStyle` would return a readonly declaration
111+
// let's hope this doesn't get passed around until it's no longer clear where it comes from
112+
const declaration = document.createElement('span').style;
108113

109114
// initial values
110115
declaration.content = '';

0 commit comments

Comments
 (0)