object-fit-images
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -27,11 +27,10 @@ 'use strict'; | ||
// Edge 12 doesn't support currentSrc https://blogs.windows.com/msedgedev/2015/10/07/using-extended-srcset-and-the-picture-element-to-tailor-your-image-to-every-device-and-layout/ | ||
// Edge 12 doesn't support currentSrc | ||
// https://github.com/bfred-it/object-fit-images/blob/gh-pages/detailed-support-tables.md#object-fit-images--srcset | ||
src = src || el.currentSrc || el.src; | ||
el.style.background = 'url(' + src + ') ' + (style['object-position'] || 'center') + '/' + style['object-fit'].replace('none', 'auto').replace('scale-down', 'contain') + ' no-repeat'; | ||
el.style.backgroundImage = 'url(' + src + ')'; | ||
el.style.backgroundPosition = style['object-position'] || 'center'; | ||
el.style.backgroundSize = style['object-fit'].replace('scale-down', 'contain'); // "object-fit: none" automatically maps to "background-size:auto" | ||
el.style.backgroundRepeat = 'no-repeat'; | ||
if (!el.style.background) { | ||
// el.style.background is invalid, don't replace the <img> | ||
return; | ||
} | ||
// remove srcset because it overrides src | ||
@@ -38,0 +37,0 @@ if (el.srcset) { |
{ | ||
"name": "object-fit-images", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Adds support to object-fit to images on IE9, IE10, IE11, Edge and other old browsers.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,3 +7,3 @@ # object-fit-images | ||
This script was made with the main use-case in mind: images. Take a look at the [demo.](http://bfred-it.github.io/object-fit-images/demo.html) | ||
This script was made with the most common use-case in mind: images. Take a look at the [demo.](http://bfred-it.github.io/object-fit-images/demo.html) | ||
@@ -128,12 +128,4 @@ ## Main features | ||
## Changelog | ||
* 2.1.0 Further byte savings | ||
* 2.0.0 Flipped `onresize` default: the values rarely change with media queries, so only enable them when needed with `{watchMQ:true}` | ||
* 1.1.0 Added `srcset` support | ||
* 1.0.0 First public release | ||
## License | ||
MIT © [Federico Brigante](http://twitter.com/bfred_it) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11382
5
0
130