CamanJS icon indicating copy to clipboard operation
CamanJS copied to clipboard

Cannot read property 'replaceChild' of null caman.js:585

Open ghost opened this issue 11 years ago • 3 comments

Hello there. Very cool library! saved me a lot of time! One thing that happened. I'm using an image object, without an image in the dom, if I resize an image it stops in replaceCanvas method, when it tries to access a parent node. Check if the parent exists solves this problem.

ghost avatar May 20 '14 20:05 ghost

Were you able to resolve this issue? I get the same issue when running Caman under Node on an existing image

atteeela avatar Feb 05 '15 17:02 atteeela

I've changed if (!Caman.NodeJS) inside of replaceCanvas prototype on line 584 to if (!Caman.NodeJS && oldCanvas.parentNode)

ghost avatar Feb 05 '15 17:02 ghost

Nice catch @timtch I had this problem too using Caman in Ionic where there is no canvas parent node. Had to modify the CoffeeScript output for now.

Here is the offending line in the CoffeeScript: https://github.com/meltingice/CamanJS/blob/master/src/core/caman.coffee#L478

benallfree avatar Nov 21 '15 01:11 benallfree