Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
SVG Test w/o Modernizr
// SVG Test
(function () {
function supportsSVG() {
return !!document.createElementNS && !! document.createElementNS('', '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