Skip to content

Commit

Permalink
Clean up references to the replaced elements during injection, which …
Browse files Browse the repository at this point in the history
…end up as detached DOM elements, so they can be GC'd
  • Loading branch information
protodave committed Jul 1, 2014
1 parent 96cb187 commit f3e1bfb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions svg-injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;

Expand Down

0 comments on commit f3e1bfb

Please sign in to comment.