Fix ReactJS TypeError, Issue #323 (#325)

* Fix ReactJS TypeError, Issue #323

* style: space after `if`

* style: space after `if`

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
Raí Toffoletto 2021-03-10 07:44:49 +00:00 committed by GitHub
parent 8bd53191b0
commit dadecb296e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,15 +82,19 @@ function animateSVG(svgContainer, elements) {
newElements.push(newElement);
animElements.push([animElement, parent]);
parent.replaceChild(animElement, unit);
if (parent) {
parent.replaceChild(animElement, unit);
}
});
let animSvg = svgContainer.cloneNode(true);
animElements.map((animElement, i) => {
animElement[1].replaceChild(newElements[i], animElement[0]);
elements[i][0] = newElements[i];
if (animElement[1]) {
animElement[1].replaceChild(newElements[i], animElement[0]);
elements[i][0] = newElements[i];
}
});
return animSvg;