Skip to content

Instantly share code, notes, and snippets.

@joemcgill
Last active August 29, 2015 14:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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