New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

objectFitPolyfill

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

objectFitPolyfill - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

2

dist/objectFitPolyfill.basic.min.js

@@ -1,1 +0,1 @@

!function(){"use strict";if("undefined"!=typeof window){var e=parseInt(window.navigator.userAgent.match(/Edge\/(\d{2})\./),10),n=!!e&&(16<=e&&e<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(e){var t=e.parentNode;!function(e){var t=window.getComputedStyle(e,null),i=t.getPropertyValue("position"),n=t.getPropertyValue("overflow"),o=t.getPropertyValue("display");i&&"static"!==i||(e.style.position="relative"),"hidden"!==n&&(e.style.overflow="hidden"),o&&"inline"!==o||(e.style.display="block"),0===e.clientHeight&&(e.style.height="100%"),-1===e.className.indexOf("object-fit-polyfill")&&(e.className=e.className+" object-fit-polyfill")}(t),function(e){var t=window.getComputedStyle(e,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)t.getPropertyValue(n)!==i[n]&&(e.style[n]=i[n])}(e),e.style.position="absolute",e.style.height="100%",e.style.width="auto",e.clientWidth>t.clientWidth?(e.style.top="0",e.style.marginTop="0",e.style.left="50%",e.style.marginLeft=e.clientWidth/-2+"px"):(e.style.width="100%",e.style.height="auto",e.style.left="0",e.style.marginLeft="0",e.style.top="50%",e.style.marginTop=e.clientHeight/-2+"px")},t=function(e){if(void 0===e||e instanceof Event)e=document.querySelectorAll("[data-object-fit]");else if(e&&e.nodeName)e=[e];else{if("object"!=typeof e||!e.length||!e[0].nodeName)return!1;e=e}for(var t=0;t<e.length;t++)if(e[t].nodeName){var i=e[t].nodeName.toLowerCase();if("img"===i){if(n)continue;e[t].complete?o(e[t]):e[t].addEventListener("load",function(){o(this)})}else"video"===i?0<e[t].readyState?o(e[t]):e[t].addEventListener("loadedmetadata",function(){o(this)}):o(e[t])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t(),window.addEventListener("resize",t),window.objectFitPolyfill=t}else window.objectFitPolyfill=function(){return!1}}}();
!function(){"use strict";if("undefined"!=typeof window){var e=window.navigator.userAgent.match(/Edge\/(\d{2})\./),t=e?parseInt(e[1],10):null,n=!!t&&(16<=t&&t<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(e){var t=e.parentNode;!function(e){var t=window.getComputedStyle(e,null),i=t.getPropertyValue("position"),n=t.getPropertyValue("overflow"),o=t.getPropertyValue("display");i&&"static"!==i||(e.style.position="relative"),"hidden"!==n&&(e.style.overflow="hidden"),o&&"inline"!==o||(e.style.display="block"),0===e.clientHeight&&(e.style.height="100%"),-1===e.className.indexOf("object-fit-polyfill")&&(e.className=e.className+" object-fit-polyfill")}(t),function(e){var t=window.getComputedStyle(e,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)t.getPropertyValue(n)!==i[n]&&(e.style[n]=i[n])}(e),e.style.position="absolute",e.style.height="100%",e.style.width="auto",e.clientWidth>t.clientWidth?(e.style.top="0",e.style.marginTop="0",e.style.left="50%",e.style.marginLeft=e.clientWidth/-2+"px"):(e.style.width="100%",e.style.height="auto",e.style.left="0",e.style.marginLeft="0",e.style.top="50%",e.style.marginTop=e.clientHeight/-2+"px")},i=function(e){if(void 0===e||e instanceof Event)e=document.querySelectorAll("[data-object-fit]");else if(e&&e.nodeName)e=[e];else{if("object"!=typeof e||!e.length||!e[0].nodeName)return!1;e=e}for(var t=0;t<e.length;t++)if(e[t].nodeName){var i=e[t].nodeName.toLowerCase();if("img"===i){if(n)continue;e[t].complete?o(e[t]):e[t].addEventListener("load",function(){o(this)})}else"video"===i?0<e[t].readyState?o(e[t]):e[t].addEventListener("loadedmetadata",function(){o(this)}):o(e[t])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("resize",i),window.objectFitPolyfill=i}else window.objectFitPolyfill=function(){return!1}}}();

@@ -1,1 +0,1 @@

!function(){"use strict";if("undefined"!=typeof window){var t=parseInt(window.navigator.userAgent.match(/Edge\/(\d{2})\./),10),n=!!t&&(16<=t&&t<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},l=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var n=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(n),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<n.clientWidth&&t.clientHeight<n.clientHeight?"none":"contain"),"none"===e?(o("x",t,i),void o("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",o("x",t,i),void o("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>n.clientWidth||"contain"===e&&t.clientWidth<n.clientWidth?(t.style.top="0",t.style.marginTop="0",o("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",o("y",t,i))))},e=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var i=t[e].nodeName.toLowerCase();if("img"===i){if(n)continue;t[e].complete?l(t[e]):t[e].addEventListener("load",function(){l(this)})}else"video"===i?0<t[e].readyState?l(t[e]):t[e].addEventListener("loadedmetadata",function(){l(this)}):l(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e(),window.addEventListener("resize",e),window.objectFitPolyfill=e}else window.objectFitPolyfill=function(){return!1}}}();
!function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,n=!!e&&(16<=e&&e<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},l=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var n=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(n),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<n.clientWidth&&t.clientHeight<n.clientHeight?"none":"contain"),"none"===e?(o("x",t,i),void o("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",o("x",t,i),void o("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>n.clientWidth||"contain"===e&&t.clientWidth<n.clientWidth?(t.style.top="0",t.style.marginTop="0",o("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",o("y",t,i))))},i=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var i=t[e].nodeName.toLowerCase();if("img"===i){if(n)continue;t[e].complete?l(t[e]):t[e].addEventListener("load",function(){l(this)})}else"video"===i?0<t[e].readyState?l(t[e]):t[e].addEventListener("loadedmetadata",function(){l(this)}):l(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("resize",i),window.objectFitPolyfill=i}else window.objectFitPolyfill=function(){return!1}}}();
{
"name": "objectFitPolyfill",
"version": "2.3.2",
"version": "2.3.3",
"description": "A Javascript polyfill for browsers that don't support the object-fit CSS property",

@@ -30,3 +30,3 @@ "main": "dist/objectFitPolyfill.min.js",

"devDependencies": {
"gulp": "^4.0.0",
"gulp": "^4.0.2",
"gulp-rename": "^1.4.0",

@@ -33,0 +33,0 @@ "gulp-uglify": "^3.0.2"

@@ -9,3 +9,3 @@ # object-fit-polyfill

- Vanilla Javascript - works with or without jQuery
- Supports IE 9+, Edge 16-18, iOS 7-, and Android 4.4-
- Supports IE 9+, Edge 18-, iOS 7-, and Android 4.4-
- Supports `object-position`

@@ -12,0 +12,0 @@ - Works with `img`, `picture`, `srcset`, `video`, and `canvas`

/*----------------------------------------
* objectFitPolyfill 2.3.2
* objectFitPolyfill 2.3.3
*

@@ -20,3 +20,4 @@ * Basic, no-frills version -

// Workaround for Edge 16-18, which only implemented object-fit for <img> tags
var edgeVersion = parseInt(window.navigator.userAgent.match(/Edge\/(\d{2})\./), 10);
var edgeMatch = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
var edgeVersion = edgeMatch ? parseInt(edgeMatch[1], 10) : null;
var edgePartialSupport = edgeVersion

@@ -23,0 +24,0 @@ ? edgeVersion >= 16 && edgeVersion <= 18

/*----------------------------------------
* objectFitPolyfill 2.3.2
* objectFitPolyfill 2.3.3
*

@@ -17,3 +17,4 @@ * Made by Constance Chen

// Workaround for Edge 16-18, which only implemented object-fit for <img> tags
var edgeVersion = parseInt(window.navigator.userAgent.match(/Edge\/(\d{2})\./), 10);
var edgeMatch = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
var edgeVersion = edgeMatch ? parseInt(edgeMatch[1], 10) : null;
var edgePartialSupport = edgeVersion

@@ -20,0 +21,0 @@ ? edgeVersion >= 16 && edgeVersion <= 18

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc