Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
  <svg "xmlns=http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"></svg>
  
  <script>
    var image = window.document.createElement("IMAGE");
    window.document.querySelector('svg').appendChild(image);
    
    // image.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'my_image.svg');
    // Produces: <image xlink:href="my_image.svg"></image>
    image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'my_image.svg');
    // Produces: <image href="my_image.svg"></image>
    // D3 makes calls like this.
    
    console.log(window.document.querySelector('image').outerHTML)
  </script>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers