object-fit-images
Advanced tools
Comparing version 0.5.3 to 0.5.4
10
ofi.js
@@ -20,6 +20,12 @@ 'use strict'; | ||
function fixOne (el, src, fit) { | ||
fit = el.currentStyle['object-fit']; | ||
// `fill` is the default behavior for <img> | ||
// Absolutely no work necessary | ||
if (fit === 'fill') { | ||
return; | ||
} | ||
src = src || el.src; | ||
fit = el.currentStyle['object-fit']; | ||
el.style.backgroundImage = 'url('+src+')'; | ||
el.style.backgroundSize = fit === 'fill'?'100% 100%':fit; // fit=none is ignored by CSS and that's the correct behavior | ||
el.style.backgroundSize = fit; // fit=none is ignored by CSS and that's the correct behavior | ||
el.style.backgroundPosition = el.currentStyle['object-position']; | ||
@@ -26,0 +32,0 @@ |
{ | ||
"name": "object-fit-images", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Adds support to object-fit to images on IE9, IE10, IE11 and Edge. (untested)", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -16,3 +16,5 @@ 100% untested at the moment. Will test soon | ||
Support | object-fit-images _(this)_ | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
### Support | ||
| | object-fit-images | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
:--- | :--- | :--- | :--- | ||
@@ -27,3 +29,5 @@ Browsers | IE 9-11, Edge | "All browsers" | IE 8-11, Edge | ||
Performance | object-fit-images _(this)_ | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
### Performance | ||
| | object-fit-images | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
:--- | :--- | :--- | :--- | ||
@@ -36,3 +40,5 @@ Size | 1.2KB | 1.8KB | 1.5KB | ||
Ease of use | object-fit-images _(this)_ | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
### Ease of use | ||
| | object-fit-images | [tonipinel/object-fit-polyfill](https://github.com/tonipinel/object-fit-polyfill) | [jonathantneal/fitie](https://github.com/jonathantneal/fitie) | ||
:--- | :--- | :--- | :--- | ||
@@ -39,0 +45,0 @@ Object-fit definition | 💚 Automatic in CSS | 💔 Via `data` attribute in HTML (`data-object-fit="cover"`) | 💔 Via class in HTML (`class="cover"`) |
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
12300
77
118