Skip to content

Instantly share code, notes, and snippets.

@jacmaes
Forked from toddmotto/gist:5595174
Last active December 17, 2015 13:10
Show Gist options
  • Save jacmaes/5615332 to your computer and use it in GitHub Desktop.
Save jacmaes/5615332 to your computer and use it in GitHub Desktop.
Detect SVG support and add HTML class. By Todd Motto.
!function(){
function supportsSVG() { return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect }
if (supportsSVG()) document.documentElement.className += ' svg'
else document.documentElement.className += ' no-svg'
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment