Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
super-simple svg feature detection
function addClass(el, cl) {
el.className += ' ' + cl;
function supportsSVG() {
return !!document.createElementNS && !!document.createElementNS('', "svg").createSVGRect;
if(supportsSVG) {
addClass(document.querySelectorAll("body")[0], "svg");
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.