From 4be4622f8f76b63ec8af4bc9075ced7abfe75886 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 28 Nov 2019 16:28:41 +0100 Subject: [PATCH] fix: Illegal constructor --- test/utils/initMatchers.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/utils/initMatchers.js b/test/utils/initMatchers.js index b83d55411732f9..6490c97250d6f1 100644 --- a/test/utils/initMatchers.js +++ b/test/utils/initMatchers.js @@ -104,7 +104,12 @@ chai.use((chaiAPI, utils) => { * @returns {CSSStyleDeclaration} */ function pretendVisibleGetComputedStyle(element) { - const declaration = new CSSStyleDeclaration(); + // `CSSStyleDeclaration` is not constructable + // https://stackoverflow.com/a/52732909/3406963 + // this is not equivalent to the declaration from `getComputedStyle` + // e.g `getComputedStyle` would return a readonly declaration + // let's hope this doesn't get passed around until it's no longer clear where it comes from + const declaration = document.createElement('span').style; // initial values declaration.content = '';