DOM Geometry interfaces shim for Node.js
npm install domgeom> __Note:__ this is a work in progress.
A polyfill for the DOM Geometry Interfaces Level 1 for JavaScript runtimes that don’t include them.
domgeom is available as an npm package:
``bash`
npm install --save domgeom
`
import {
DOMMatrix,
DOMMatrixReadOnly,
DOMPoint,
DOMPointReadOnly,
DOMRect,
DOMRectReadOnly,
DOMQuad
} from 'domgeom';
globalThis.DOMMatrix = DOMMatrix;
globalThis.DOMMatrixReadOnly = DOMMatrixReadOnly;
globalThis.DOMPoint = DOMPoint;
globalThis.DOMPointReadOnly = DOMPointReadOnly;
globalThis.DOMRect = DOMRect;
globalThis.DOMRectReadOnly = DOMRectReadOnly;
globalThis.DOMQuad = DOMQuad;
`
* DOMMatrixReadOnly.prototype.toString() throws an Error instead of an "InvalidStateError" DOMException`.
* The read-only interfaces are not actually read only (it just seemed tedious to implement).
Also note that due to numerical errors there may be slight differences in the matrix values compared to browser environments. In tests, rounding the values before comparisons is recommended.
* CSS Transforms Level 2: Mathematical Description of Transform Functions
* CSS tokenization code is taken from Selery.