iconic / SVGInjector

Fast, caching, dynamic inline SVG DOM injection library
MIT License
974 stars 145 forks source link

parentNode is null JS Error #32

Open sean-roberts opened 9 years ago

sean-roberts commented 9 years ago

Hey guys, I am using the iconic.js library and I can isolate that it's the SVGInjector line that is causing me troubles:

https://github.com/iconic/SVGInjector/blob/8fefa156b0028746562520a47cb1ef6121196d34/svg-injector.js#L377

The context of my issue is, I have an angular application that uses iconic to handle loading in the svgs. We are running into issues because of some weird intermediate states that the parentNode is null for certain elements, like when we are binding to the element before it gets into the dom like on a directive template replacement.

That said, I am wondering if making the check for whether or not the image is available to be replaced (via parentNode.replaceChild) is a condition worthy of being added as a prerequisite for processing similar to the perquisites of it being a .svg file type?