Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.