Skip to content

Commit

Permalink
1.0.0-RC3
Browse files Browse the repository at this point in the history
  • Loading branch information
aFarkas committed Feb 25, 2015
1 parent c591e33 commit db6b37e
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Add the ``class`` ``lazyload`` to all ``img`` and ``iframe`` elements, which sho
responsive-image3.jpg 900w" class="lazyload" />
```

**Important: How ``sizes`` is calculated**: The automatic sizes calculation takes the width of the image. If it is below ``50`` (can be configured through the ``minSize`` option), lazySizes traverses up the DOM tree until it finds a parent which is over ``50`` and uses this number. Often the following general CSS rule might help: ``img[data-sizes="auto"] { display: block; }``. (see also [specifying image/iframe dimensions](#specify-dimensions)
**Important: How ``sizes`` is calculated**: The automatic sizes calculation takes the width of the image. If it is below ``50`` (can be configured through the ``minSize`` option), lazySizes traverses up the DOM tree until it finds a parent which is over ``50`` and uses this number. Often the following general CSS rule might help: ``img[data-sizes="auto"] { display: block; }``. (see also [specifying image/iframe dimensions](#specify-dimensions))

##Recommended markup patterns
For some image bots (search engines and social networks), legacy browsers (IE8) or JS disabled browsers, it is important to serve a usable ``src`` attribute:
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lazysizes",
"repo": "afarkas/lazysizes",
"version": "1.0.0-pre",
"version": "1.0.0-RC3",
"main": "lazysizes.js",
"scripts": [
"lazysizes.js",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lazysizes",
"version": "1.0.0-pre",
"version": "1.0.0-RC3",
"repo": "afarkas/lazysizes",
"main": "lazysizes.min.js",
"scripts": ["lazysizes.min.js"],
Expand Down
2 changes: 1 addition & 1 deletion lazysizes.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lazysizes",
"version": "1.0.0-pre",
"version": "1.0.0-RC3",
"filename": "lazysizes.min.js",
"author": "Alexander Farkas <[email protected]>",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/bgset/ls.bgset.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/custommedia/ls.custommedia.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions plugins/fix-ios-sizes/fix-ios-sizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@

if(('srcset' in img) && !('sizes' in img)){
regPicture = /^picture$/i;
addEventListener('lazybeforeunveil', function(e){
document.addEventListener('lazybeforeunveil', function(e){
var elem, parent, srcset, sizes, isPicture;
var picture, source;

if(e.defaultPrevented ||
lazySizesConfig.noIOSFix ||
!(elem = e.target) ||
Expand All @@ -37,22 +36,28 @@
){return;}

picture = isPicture ? parent : document.createElement('picture');
source = document.createElement('source');

if(!elem._lazyImgSrc){
Object.defineProperty(elem, '_lazyImgSrc', {
value: document.createElement('source'),
writable: true
});
}
source = elem._lazyImgSrc;

if(sizes){
source.setAttribute('sizes', sizes);
}

source.setAttribute(lazySizesConfig.srcsetAttr, srcset);
elem.setAttribute('data-pfsrcset', srcset);
elem.removeAttribute(lazySizesConfig.srcsetAttr);

if(isPicture){
parent.insertBefore(source, elem);
} else {
picture.appendChild(source);
if(!isPicture){
parent.insertBefore(picture, elem);
picture.appendChild(elem);
}
picture.insertBefore(source, elem);
});
}
})(document);
4 changes: 2 additions & 2 deletions plugins/fix-ios-sizes/fix-ios-sizes.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/include/ls.include.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions plugins/optimumx/ls.optimumx.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@
lazyData.cSrcset.join(', ');
elem.setAttribute(attr, lazyData.cSrcset.join(', '));
lazyData.dirty = true;

if(lazyData.cSrcset.length >= lazyData.cands.length){
elem.removeAttribute('data-optimumx');
elem.removeAttribute('data-maxdpr');
}
}
};

Expand Down
Loading

0 comments on commit db6b37e

Please sign in to comment.