From 754bdf1ef3e7910470698e83da9db48fdadf2c99 Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Wed, 26 Apr 2017 21:15:25 +0900 Subject: [PATCH] 3.2.1 --- dist/ofi.js | 5 +++-- dist/ofi.min.js | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dist/ofi.js b/dist/ofi.js index 672298b..24ccb67 100644 --- a/dist/ofi.js +++ b/dist/ofi.js @@ -1,4 +1,4 @@ -/*! npm.im/object-fit-images 3.2.0 */ +/*! npm.im/object-fit-images 3.2.1 */ var objectFitImages = (function () { 'use strict'; @@ -112,7 +112,7 @@ function fixOne(el) { keepSrcUsable(el); } catch (err) { if (window.console) { - console.log('http://bit.ly/ofi-old-browser'); + console.warn('https://bit.ly/ofi-old-browser'); } } } @@ -122,6 +122,7 @@ function fixOne(el) { el.style.backgroundImage = "url(\"" + ((ofi.img.currentSrc || ofi.img.src).replace(/"/g, '\\"')) + "\")"; el.style.backgroundPosition = style['object-position'] || 'center'; el.style.backgroundRepeat = 'no-repeat'; + el.style.backgroundOrigin = 'content-box'; if (/scale-down/.test(style['object-fit'])) { onImageReady(ofi.img, function () { diff --git a/dist/ofi.min.js b/dist/ofi.min.js index 7b696c2..c88fb36 100644 --- a/dist/ofi.min.js +++ b/dist/ofi.min.js @@ -1,2 +1,2 @@ -/*! npm.im/object-fit-images 3.2.0 */ -var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!p&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=u.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);b.call(e,"src")!==n&&h.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[l];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&f&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=b.call(t,"data-ofi-srcset")||t.srcset,o.img.src=b.call(t,"data-ofi-src")||t.src,h.call(t,"data-ofi-src",t.src),t.srcset&&h.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.log("http://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[l].img[e?e:"src"]},set:function(e,i){return t[l].img[i?i:"src"]=e,h.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(){function t(t,e){return t[l]&&t[l].img&&("src"===e||"srcset"===e)?t[l].img:t}d||(HTMLImageElement.prototype.getAttribute=function(e){return b.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return h.call(t(this,e),e,String(i))})}function a(t,e){var i=!y&&!t;if(e=e||{},t=t||"img",d&&!e.skipTest||!m)return!1;"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;rt.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[a].img[e||"src"]},set:function(e,i){return t[a].img[i||"src"]=e,b.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(t,e){var i=!h&&!t;if(e=e||{},t=t||"img",f&&!e.skipTest||!d)return!1;"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r