Skip to content

Instantly share code, notes, and snippets.

@advitum
Created July 24, 2015 14:09
Show Gist options
  • Save advitum/a09184115cf0a5567df0 to your computer and use it in GitHub Desktop.
Save advitum/a09184115cf0a5567df0 to your computer and use it in GitHub Desktop.
Creating SVG elements with correct namespace.
function createSvgElement(tag, attributes) {
var element = document.createElementNS('http://www.w3.org/2000/svg', tag);
for(var k in attributes) {
element.setAttribute(k, attributes[k]);
}
return element;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment