@@ -114,6 +114,7 @@ window.matchMedia || (window.matchMedia = function() {
114
114
pf . getWidthFromLength = function ( length ) {
115
115
// If a length is specified and doesn’t contain a percentage, and it is greater than 0 or using `calc`, use it. Else, use the `100vw` default.
116
116
length = length && length . indexOf ( "%" ) > - 1 === false && ( parseFloat ( length ) > 0 || length . indexOf ( "calc(" ) > - 1 ) ? length : "100vw" ;
117
+
117
118
/**
118
119
* If length is specified in `vw` units, use `%` instead since the div we’re measuring
119
120
* is injected at the top of the document.
@@ -136,7 +137,7 @@ window.matchMedia || (window.matchMedia = function() {
136
137
137
138
if ( pf . lengthEl . offsetWidth <= 0 ) {
138
139
// Something has gone wrong. `calc()` is in use and unsupported, most likely. Default to `100vw` (`100%`, for broader support.):
139
- pf . lengthEl . style . cssText = "width: 100%; ";
140
+ pf . lengthEl . style . width = doc . documentElement . offsetWidth + "px ";
140
141
}
141
142
142
143
return pf . lengthEl . offsetWidth ;
@@ -413,15 +414,14 @@ window.matchMedia || (window.matchMedia = function() {
413
414
// http://picture.responsiveimages.org/#the-img-element
414
415
picImg . currentSrc = picImg . src ;
415
416
416
- var
417
- style = picImg . style || { } ,
418
- hasWebkitBackfaceVisibility = "webkitBackfaceVisibility" in style ,
419
- currentZoom = style . zoom ;
417
+ var style = picImg . style || { } ,
418
+ WebkitBackfaceVisibility = "webkitBackfaceVisibility" in style ,
419
+ currentZoom = style . zoom ;
420
420
421
- if ( hasWebkitBackfaceVisibility ) {
421
+ if ( WebkitBackfaceVisibility ) { // See: https://github.com/scottjehl/picturefill/issues/332
422
422
style . zoom = ".999" ;
423
423
424
- hasWebkitBackfaceVisibility = picImg . offsetWidth ;
424
+ WebkitBackfaceVisibility = picImg . offsetWidth ;
425
425
426
426
style . zoom = currentZoom ;
427
427
}
0 commit comments