Skip to content

Instantly share code, notes, and snippets.

@aronwoost
Created July 3, 2014 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aronwoost/4f27d5642f12406ed754 to your computer and use it in GitHub Desktop.
Save aronwoost/4f27d5642f12406ed754 to your computer and use it in GitHub Desktop.
super-simple svg feature detection
<script>
function addClass(el, cl) {
el.className += ' ' + cl;
}
function supportsSVG() {
return !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect;
}
if(supportsSVG) {
console.log(document.querySelectorAll("body"));
addClass(document.querySelectorAll("body")[0], "svg");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment