Joined February 2014
·

Patrick Harrington

Boston, Massachusetts
·
·

Posted to Fallback SVG to PNG in img element over 1 year ago

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'}}}

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.

Achievements
1 Karma
0 Total ProTip Views
Interests & Skills