Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #559 from scottjehl/3.0-rc1-preparation
Browse files Browse the repository at this point in the history
3.0 rc1 preparation
  • Loading branch information
Alexander Farkas committed Sep 8, 2015
2 parents 552823f + a1f342a commit 4dd3c95
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 58 deletions.
58 changes: 36 additions & 22 deletions dist/picturefill.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/*! Picturefill - v3.0.0-beta1 - 2015-07-24
* http://scottjehl.github.io/picturefill
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
/*! Picturefill - v3.0.0-rc1 - 2015-08-21
* http://scottjehl.github.io/picturefill
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT
*/
/*! Gecko-Picture - v1.0
* https://github.com/scottjehl/picturefill/tree/3.0/src/plugins/gecko-picture
* Firefox's early picture implementation (prior to FF41) is static and does
* not react to viewport changes. This tiny module fixes this.
*/
(function(window) {
/*jshint eqnull:true */
var ua = navigator.userAgent;
Expand Down Expand Up @@ -65,13 +71,13 @@
}
})(window);

/*! Picturefill - Responsive Images that work today.
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
/*! Picturefill - v3.0.0-beta
* http://scottjehl.github.io/picturefill
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt;
* License: MIT
* Spec: http://picture.responsiveimages.org/
*/

(function( window, document, undefined ) {
/* global parseSizes */
// Enable strict mode
"use strict";

Expand Down Expand Up @@ -192,7 +198,7 @@
return string;
};

var buidlStr = memoize(function(css) {
var buildStr = memoize(function(css) {

return "return " + replace((css || "").toLowerCase(),
// interpret `and`
Expand Down Expand Up @@ -226,7 +232,7 @@
} else {
/*jshint evil:true */
try{
cssCache[css] = new Function("e", buidlStr(css))(units);
cssCache[css] = new Function("e", buildStr(css))(units);
} catch(e) {}
/*jshint evil:false */
}
Expand Down Expand Up @@ -740,9 +746,6 @@
} // (Close of big while loop.)
}

/* jshint ignore:start */
// jscs:disable

/*
* Sizes Parser
*
Expand Down Expand Up @@ -825,9 +828,9 @@

// (Loop forwards from the beginning of the string.)
while (true) {
chrctr = str[pos];
chrctr = str.charAt(pos);

if (chrctr === undefined) { // ( End of string reached.)
if (chrctr === "") { // ( End of string reached.)
pushComponent();
pushComponentArray();
return listArray;
Expand All @@ -845,7 +848,7 @@
// (If previous character in loop was also a space, or if
// at the beginning of the string, do not add space char to
// component.)
if ((str[pos - 1] && isSpace(str[pos - 1])) || (!component)) {
if ( (str.charAt(pos - 1) && isSpace( str.charAt(pos - 1) ) ) || !component ) {
pos += 1;
continue;
} else if (parenDepth === 0) {
Expand All @@ -861,11 +864,11 @@
} else if (chrctr === ")") {
parenDepth -= 1;
} else if (chrctr === ",") {
pushComponent()
pushComponent();
pushComponentArray();
pos += 1;
continue;
} else if ((chrctr === "/") && (str[pos + 1] === "*")) {
} else if ( (chrctr === "/") && (str.charAt(pos + 1) === "*") ) {
inComment = true;
pos += 2;
continue;
Expand Down Expand Up @@ -949,15 +952,23 @@
// size value, return 100vw.
return "100vw";
}
// jscs: enable
/* jshint ignore:end */

// namespace
pf.ns = ("pf" + new Date().getTime()).substr(0, 9);

// srcset support test
pf.supSrcset = "srcset" in image;
pf.supSizes = "sizes" in image;
pf.supPicture = !!window.HTMLPictureElement;

if (pf.supSrcset && pf.supPicture && !pf.supSizes) {
(function(image2) {
image.srcset = "data:,a";
image2.src = "data:,a";
pf.supSrcset = image.complete === image2.complete;
pf.supPicture = pf.supSrcset && pf.supPicture;
})(document.createElement("img"));
}

// using pf.qsa instead of dom traversing does scale much better,
// especially on sites mixing responsive and non-responsive images
Expand Down Expand Up @@ -1391,7 +1402,7 @@
};

// If picture is supported, well, that's awesome.
if ( window.HTMLPictureElement ) {
if ( pf.supPicture ) {
picturefill = noop;
pf.fillImg = noop;
} else {
Expand Down Expand Up @@ -1451,8 +1462,6 @@

on( window, "resize", debounce(onResize, 99 ) );
on( document, "readystatechange", run );

types[ "image/webp" ] = detectTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==" );
})();
}

Expand Down Expand Up @@ -1495,4 +1504,9 @@
define( "picturefill", function() { return picturefill; } );
}

// IE8 evals this sync, so it must be the last thing we do
if ( !pf.supPicture ) {
types[ "image/webp" ] = detectTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==" );
}

} )( window, document );
9 changes: 5 additions & 4 deletions dist/picturefill.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plugins/intrinsic-dimension/pf.intrinsic.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
}
};

if (window.addEventListener && !window.HTMLPictureElement) {
if (window.addEventListener && !pf.supPicture) {
addEventListener("resize", reeval, false);
}

Expand Down
9 changes: 5 additions & 4 deletions dist/plugins/intrinsic-dimension/pf.intrinsic.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 dist/plugins/mutation/pf.mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
}
};

if ( !window.HTMLPictureElement ) {
if ( !pf.supPicture ) {

if ( MutationObserver && !pf.testMutationEvents ) {
observer = new MutationObserver( pf.onMutations );
Expand Down
9 changes: 5 additions & 4 deletions dist/plugins/mutation/pf.mutation.min.js

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

Loading

0 comments on commit 4dd3c95

Please sign in to comment.