Joined February 2014
·
Posted to
Fallback SVG to PNG in img element
over 1 year
ago
The minified code is missing the brackets from the Modernizr.SVG check, so the for statement is being run regardless.
The minified code is missing the brackets from the Modernizr.SVG check, so the for statement is being run regardless.
There is also a semi-colon missing in the first line of the for statement - here is fixed minified code:
if(!Modernizr.svg){var i=document.getElementsByTagName("img"),j,y;for(j=i.length;j--;){y=i[j].src;if(y.match(/svg$/)){i[j].src=y.slice(0,-3)+'png'}}}