load all images directly when in 'no-transform'-mode

This commit is contained in:
Hakim El Hattab 2014-04-28 09:13:57 +02:00
parent 6aaff6395a
commit b42fae96e5
1 changed files with 11 additions and 0 deletions

View File

@ -208,6 +208,17 @@
if( !features.transforms2d && !features.transforms3d ) {
document.body.setAttribute( 'class', 'no-transforms' );
// Since JS won't be running any further, we need to load all
// images that were intended to lazy load now
var images = document.getElementsByTagName( 'img' );
for( var i = 0, len = images.length; i < len; i++ ) {
var image = images[i];
if( image.getAttribute( 'data-src' ) ) {
image.setAttribute( 'src', image.getAttribute( 'data-src' ) );
image.removeAttribute( 'data-src' );
}
}
// If the browser doesn't support core features we won't be
// using JavaScript to control the presentation
return;