Skip to content

Instantly share code, notes, and snippets.

@toddmotto
Created May 16, 2013 21:17
Show Gist options
  • Save toddmotto/5595174 to your computer and use it in GitHub Desktop.
Save toddmotto/5595174 to your computer and use it in GitHub Desktop.
Three-line SVG detect and HTML class appends
!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