Last active
August 29, 2015 14:04
-
-
Save joemcgill/eea85be25449eb6cc773 to your computer and use it in GitHub Desktop.
SVG Test w/o Modernizr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SVG Test | |
(function () { | |
function supportsSVG() { | |
return !!document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect; | |
} | |
if (!supportsSVG()) { | |
document.documentElement.className += ' no-svg'; | |
// optional .png fallback for .svg files inlined as <img> elements | |
$("img[src$='.svg']").attr("src", function() { | |
return $(this).attr('src').replace('.svg', '.png'); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment