I'm using Katex to display mathematical expressions and I wan't to save them as images, but dom-to-image crashes with the error "target is undefined".
I found out that it's happening in this function:
function cloneStyle() {
copyStyle(window.getComputedStyle(original), clone.style);
function copyStyle(source, target) {
if (source.cssText) target.cssText = source.cssText;
else copyProperties(source, target);
function copyProperties(source, target) {
util.asArray(source).forEach(function (name) {
target.setProperty(
name,
source.getPropertyValue(name),
source.getPropertyPriority(name)
);
});
}
}
}
Basically clone is a <mi /> Element from MathML which doesn't have a style-attribute, therefore the target.setProperties()-function is executed on an undefined attribute and crashes.
Hi,
I'm using Katex to display mathematical expressions and I wan't to save them as images, but dom-to-image crashes with the error "target is undefined". I found out that it's happening in this function:
Basically
clone
is a<mi />
Element from MathML which doesn't have astyle
-attribute, therefore thetarget.setProperties()
-function is executed on an undefined attribute and crashes.Here is a simple demo project. Run
npm install
,npm run start
to start it.