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

Commit 4dd3c95

Browse files
author
Alexander Farkas
committed
Merge pull request #559 from scottjehl/3.0-rc1-preparation
3.0 rc1 preparation
2 parents 552823f + a1f342a commit 4dd3c95

File tree

17 files changed

+88
-58
lines changed

17 files changed

+88
-58
lines changed

dist/picturefill.js

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
/*! Picturefill - v3.0.0-beta1 - 2015-07-24
2-
* http://scottjehl.github.io/picturefill
3-
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
1+
/*! Picturefill - v3.0.0-rc1 - 2015-08-21
2+
* http://scottjehl.github.io/picturefill
3+
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT
4+
*/
5+
/*! Gecko-Picture - v1.0
6+
* https://github.com/scottjehl/picturefill/tree/3.0/src/plugins/gecko-picture
7+
* Firefox's early picture implementation (prior to FF41) is static and does
8+
* not react to viewport changes. This tiny module fixes this.
9+
*/
410
(function(window) {
511
/*jshint eqnull:true */
612
var ua = navigator.userAgent;
@@ -65,13 +71,13 @@
6571
}
6672
})(window);
6773

68-
/*! Picturefill - Responsive Images that work today.
69-
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
74+
/*! Picturefill - v3.0.0-beta
75+
* http://scottjehl.github.io/picturefill
76+
* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt;
7077
* License: MIT
71-
* Spec: http://picture.responsiveimages.org/
7278
*/
79+
7380
(function( window, document, undefined ) {
74-
/* global parseSizes */
7581
// Enable strict mode
7682
"use strict";
7783

@@ -192,7 +198,7 @@
192198
return string;
193199
};
194200

195-
var buidlStr = memoize(function(css) {
201+
var buildStr = memoize(function(css) {
196202

197203
return "return " + replace((css || "").toLowerCase(),
198204
// interpret `and`
@@ -226,7 +232,7 @@
226232
} else {
227233
/*jshint evil:true */
228234
try{
229-
cssCache[css] = new Function("e", buidlStr(css))(units);
235+
cssCache[css] = new Function("e", buildStr(css))(units);
230236
} catch(e) {}
231237
/*jshint evil:false */
232238
}
@@ -740,9 +746,6 @@
740746
} // (Close of big while loop.)
741747
}
742748

743-
/* jshint ignore:start */
744-
// jscs:disable
745-
746749
/*
747750
* Sizes Parser
748751
*
@@ -825,9 +828,9 @@
825828

826829
// (Loop forwards from the beginning of the string.)
827830
while (true) {
828-
chrctr = str[pos];
831+
chrctr = str.charAt(pos);
829832

830-
if (chrctr === undefined) { // ( End of string reached.)
833+
if (chrctr === "") { // ( End of string reached.)
831834
pushComponent();
832835
pushComponentArray();
833836
return listArray;
@@ -845,7 +848,7 @@
845848
// (If previous character in loop was also a space, or if
846849
// at the beginning of the string, do not add space char to
847850
// component.)
848-
if ((str[pos - 1] && isSpace(str[pos - 1])) || (!component)) {
851+
if ( (str.charAt(pos - 1) && isSpace( str.charAt(pos - 1) ) ) || !component ) {
849852
pos += 1;
850853
continue;
851854
} else if (parenDepth === 0) {
@@ -861,11 +864,11 @@
861864
} else if (chrctr === ")") {
862865
parenDepth -= 1;
863866
} else if (chrctr === ",") {
864-
pushComponent()
867+
pushComponent();
865868
pushComponentArray();
866869
pos += 1;
867870
continue;
868-
} else if ((chrctr === "/") && (str[pos + 1] === "*")) {
871+
} else if ( (chrctr === "/") && (str.charAt(pos + 1) === "*") ) {
869872
inComment = true;
870873
pos += 2;
871874
continue;
@@ -949,15 +952,23 @@
949952
// size value, return 100vw.
950953
return "100vw";
951954
}
952-
// jscs: enable
953-
/* jshint ignore:end */
954955

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

958959
// srcset support test
959960
pf.supSrcset = "srcset" in image;
960961
pf.supSizes = "sizes" in image;
962+
pf.supPicture = !!window.HTMLPictureElement;
963+
964+
if (pf.supSrcset && pf.supPicture && !pf.supSizes) {
965+
(function(image2) {
966+
image.srcset = "data:,a";
967+
image2.src = "data:,a";
968+
pf.supSrcset = image.complete === image2.complete;
969+
pf.supPicture = pf.supSrcset && pf.supPicture;
970+
})(document.createElement("img"));
971+
}
961972

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

13931404
// If picture is supported, well, that's awesome.
1394-
if ( window.HTMLPictureElement ) {
1405+
if ( pf.supPicture ) {
13951406
picturefill = noop;
13961407
pf.fillImg = noop;
13971408
} else {
@@ -1451,8 +1462,6 @@
14511462

14521463
on( window, "resize", debounce(onResize, 99 ) );
14531464
on( document, "readystatechange", run );
1454-
1455-
types[ "image/webp" ] = detectTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==" );
14561465
})();
14571466
}
14581467

@@ -1495,4 +1504,9 @@
14951504
define( "picturefill", function() { return picturefill; } );
14961505
}
14971506

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

dist/picturefill.min.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/intrinsic-dimension/pf.intrinsic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
}
134134
};
135135

136-
if (window.addEventListener && !window.HTMLPictureElement) {
136+
if (window.addEventListener && !pf.supPicture) {
137137
addEventListener("resize", reeval, false);
138138
}
139139

dist/plugins/intrinsic-dimension/pf.intrinsic.min.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/mutation/pf.mutation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
}
229229
};
230230

231-
if ( !window.HTMLPictureElement ) {
231+
if ( !pf.supPicture ) {
232232

233233
if ( MutationObserver && !pf.testMutationEvents ) {
234234
observer = new MutationObserver( pf.onMutations );

dist/plugins/mutation/pf.mutation.min.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)