meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.55k stars 404 forks source link

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

Open ghost opened 10 years ago

ghost commented 10 years ago

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 commented 9 years ago

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

ghost commented 9 years ago

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

benallfree commented 8 years ago

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