title: SVG injection with template literals doesn't work in browser
body: <p>My idea is to inject inline SVG to my HTML using template literals. 
  The purpose is simply use benefits of styling inline SVG icons with CSS but avoid bloating html code with SVG stuff. Also it's very easy to reuse repeating icons by just adding corresponding class. Also all icons or vector stuff like logo can be stored in single JS file. I know, that's hacky weird idea, but I found it's useful for my project. </p>
  
  <p><strong>So the problem is that my script won't work in browser</strong> from my local files. 
  But it works well in CodePen and JSFiddle.
  <em>Local file restrictions are disabled, JS is enabled.</em> </p>
  
  <p>Also any ideas how to optimize it and make it work better are welcome. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var iconLogo = document.querySelectorAll(".ric-logo");
  var i; 
  for (i = 0; i &lt; iconLogo.length; i++) {
      iconLogo[i].innerHTML = `
  &lt;svg width="120px" height="18px" viewBox="0 0 120 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
      &lt;g id="ric-logo" stroke="none" stroke-width="1" fill="black" fill-rule="evenodd"&gt;
                  &lt;path d="M23.326087,0 C23.2252174,0 23.1275,0 23.0266304,0 L23.0266304,0 L2.52173913,0 C1.12902107,-8.82200545e-17 1.70558772e-16,1.16795283 0,2.60869565 L0,15 L5.04347826,15 L5.04347826,5.2173913 C5.04347826,4.8572056 5.32573353,4.56521739 5.67391304,4.56521739 L22.9730435,4.56521739 C23.631932,4.55997742 24.1901947,5.0660023 24.2717391,5.7423913 C24.306535,6.10977596 24.1892199,6.47520901 23.948885,6.74807191 C23.7085502,7.02093481 23.3677046,7.17567223 23.0108696,7.17391304 L7.56521739,7.17391304 L7.56521739,11.7391304 L23.0266304,11.7391304 L23.0266304,11.7391304 C23.1275,11.7391304 23.2252174,11.7391304 23.326087,11.7391304 C26.4597026,11.7391304 29,9.11123658 29,5.86956522 C29,2.62789386 26.4597026,1.98495123e-16 23.326087,0 Z" id="Path"&gt;&lt;/path&gt;
                  &lt;path d="M64.9565217,1.21154527e-06 L61.173913,1.21154527e-06 C60.170401,-0.000815107822 59.2077021,0.410915432 58.4977174,1.14456624 L49.8796739,10.0532605 C49.6430123,10.2978107 49.3221127,10.4350542 48.9876087,10.4347821 L46.673913,10.4347821 C46.3257335,10.4347821 46.0434783,10.142794 46.0434783,9.78260833 L46.0434783,1.21154527e-06 L41,0 L41,12.3913036 C41,13.8320462 42.1290211,14.9999988 43.5217391,14.9999988 L49.826087,14.9999988 C50.829599,15.0008151 51.7922979,14.5890846 52.5022826,13.8554338 L61.1108696,4.95000041 C61.3493224,4.70184137 61.674158,4.56319679 62.0123913,4.56521787 L64.326087,4.56521787 C64.6742665,4.56521787 64.9565217,4.85720602 64.9565217,5.21739167 L64.9565217,14.9999988 L70,15 L70,2.60869644 C70,1.16795385 68.8709789,1.21154527e-06 67.4782609,1.21154527e-06 L64.9565217,1.21154527e-06 Z" id="Path"&gt;&lt;/path&gt;
                  &lt;path d="M114,10 L120,10 L120,16 C120,17.1045695 118.992641,18 117.75,18 L114,18 L114,10 Z" id="Path"&gt;&lt;/path&gt;
                  &lt;path d="M106,0 L106,9.7826087 C106,10.1427944 105.720178,10.4347826 105.375,10.4347826 L87.625,10.4347826 C87.279822,10.4347826 87,10.1427944 87,9.7826087 L87,0 L82,0 L82,12.3913043 C82,13.8320472 83.1192881,15 84.5,15 L108.5,15 C109.880712,15 111,13.8320472 111,12.3913043 L111,0 L106,0 Z" id="Path"&gt;&lt;/path&gt;
      &lt;/g&gt;
  &lt;/svg&gt;
  `;
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>/* Styling all instances of SVG */
  
  .ric-logo * {
    fill: blue;
   width: 120px;
   height: 15px;
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
  &lt;header class="header-menu"&gt;
   &lt;div class="ric-logo"&gt;
   &lt;/div&gt;
   &lt;div class="menu-content"&gt;
    &lt;ul&gt;
     &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;Item-1&lt;/li&gt;
     &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;Item-2&lt;/li&gt;
     &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;Item-3&lt;/li&gt;
     &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;Item-4&lt;/li&gt;
    &lt;/ul&gt;
   &lt;/div&gt;
  &lt;/header&gt;
  &lt;main&gt;
    &lt;!-- Test repeating SVG class --&gt;
    &lt;div class="ric-logo"&gt;
   &lt;/div&gt;
  &lt;/main&gt;
  &lt;footer&gt;&lt;/footer&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>