Skip to content

Commit

Permalink
fix: Illegal constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 28, 2019
1 parent dacacce commit 4be4622
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/utils/initMatchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down

0 comments on commit 4be4622

Please sign in to comment.