Permalink
Browse files

Clean up references to the replaced elements during injection, which …

…end up as detached DOM elements, so they can be GC'd
  • Loading branch information...
protodave committed Jul 1, 2014
1 parent 96cb187 commit f3e1bfb77358ca6404c3aeffea9aae316cc5d919
Showing with 5 additions and 0 deletions.
  1. +5 −0 svg-injector.js
View
@@ -337,6 +337,11 @@
// Replace the image with the svg
el.parentNode.replaceChild(svg, el);
// Now that we no longer need it, drop references
// to the original element so it can be GC'd
delete injectedElements[injectedElements.indexOf(el)];
el = null;
// Increment the injected count
injectCount++;

0 comments on commit f3e1bfb

Please sign in to comment.