Skip to content

Instantly share code, notes, and snippets.

@joemcgill
Last active Aug 29, 2015
Embed
What would you like to do?
SVG Test w/o Modernizr
// 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