Created
June 24, 2014 10:53
-
-
Save PixievoltNo1/431fe9b15fe66bcd1f9c to your computer and use it in GitHub Desktop.
SVG Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shortcut functions makeSVGElem & makeUseElem for making SVG elements | |
var svgNS = "http://www.w3.org/2000/svg"; | |
function makeSVGElem(name) { return document.createElementNS(svgNS, name); } | |
function makeUseElem(url) { | |
var elem = makeSVGElem("use"); | |
elem.setAttributeNS("http://www.w3.org/1999/xlink", "href", url); | |
return elem; | |
} | |
// Workaround for jQuery bug #11166 to allow setting viewBox | |
$.attrHooks.viewbox = { set: function(elem, value) { | |
elem.setAttribute("viewBox", value); | |
return value; | |
} }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment