JSDOM is supposed to be a library that implements webbrowser DOM, so that we can use and test browser-like behaviour in node. It's quite a good solution, if it wasn't for the fact that we already encountered two bugs in JSDOM, which caused us a lot of trouble and worry.
-
window.getComputedStyle()
doesn't take the specificity of selectors into account. At the time of writing the issue was still unresolved: https://github.com/jsdom/jsdom/issues/3318. Bug found in writing unit tests for view, we were trying to test whether certain decorations are applied andgetComputedStyle()
failed to return the proper values. We had to create a workaround, simply we didn't use CSS specificity for the values, which is an anti-pattern. -
document.createRange()
is improperly implemented, resulting ingetClientRects()
not being defined somewhat arbitrarily. It would seam that it related to time and frame capturing in internal JSDOM implementations. The issue is still unresolved: https://github.com/jsdom/jsdom/issues/3002. We need to workaround this by disabling autocomplete checks inpaste.test.js
, which would work fine if it wasn't for the JSDOM bug.
Package in @codemirror
are not completely independent of one another. Often times, updating a version of one of them
breaks something in the other. The silver lining is that the maintainers of code mirror, when releasing a change
that can break something, very often release corresponding packages updates as well. That's why, it's a good idea
to always update all of @codemirror
dependencies at once, and never update them separately.