Igor150195

FIX LPC SVG

Dec 13th, 2022
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const renderSVG = function () {
  2.     let container = document.querySelectorAll('.lpc-features-8__features-icon-inner');
  3.  
  4.     if (!!container) { // since You want to check existence of elements
  5.  
  6.         for (let i = 0; i < container.length; i++) {
  7.             const element = container[i];
  8.  
  9.             let svg = element.querySelector('svg');
  10.  
  11.             const XML = new XMLSerializer().serializeToString(svg);
  12.             const SVG64 = btoa(XML);
  13.  
  14.             const img = new Image();
  15.             img.src = 'data:image/svg+xml;base64,' + SVG64;
  16.  
  17.             svg.remove();
  18.             element.appendChild(img);
  19.         }
  20.     }
  21. };
  22.  
  23. renderSVG();
Add Comment
Please, Sign In to add comment