From 6d383d447aef779a2e2eff146280f1804eecbde4 Mon Sep 17 00:00:00 2001 From: Wapweb Date: Sun, 1 Apr 2018 00:42:41 +0300 Subject: [PATCH] Add -o-object-fit check --- src/objectFitPolyfill.basic.js | 4 +++- src/objectFitPolyfill.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/objectFitPolyfill.basic.js b/src/objectFitPolyfill.basic.js index 454d0ec..e803165 100644 --- a/src/objectFitPolyfill.basic.js +++ b/src/objectFitPolyfill.basic.js @@ -22,9 +22,11 @@ // TODO: Keep an eye on Edge to determine which version has full final support var edgeVersion = window.navigator.userAgent.match(/Edge\/(\d{2})\./); var edgePartialSupport = (edgeVersion) ? (parseInt(edgeVersion[1], 10) >= 16) : false; + var objectFitSupport = "objectFit" in document.documentElement.style !== false || + "OObjectFit" in document.documentElement.style !== false; // If the browser does support object-fit, we don't need to continue - if ("objectFit" in document.documentElement.style !== false && !edgePartialSupport) { + if (objectFitSupport && !edgePartialSupport) { window.objectFitPolyfill = function() { return false }; return; } diff --git a/src/objectFitPolyfill.js b/src/objectFitPolyfill.js index a0df129..4c8ed50 100644 --- a/src/objectFitPolyfill.js +++ b/src/objectFitPolyfill.js @@ -19,9 +19,11 @@ // TODO: Keep an eye on Edge to determine which version has full final support var edgeVersion = window.navigator.userAgent.match(/Edge\/(\d{2})\./); var edgePartialSupport = (edgeVersion) ? (parseInt(edgeVersion[1], 10) >= 16) : false; + var objectFitSupport = "objectFit" in document.documentElement.style !== false || + "OObjectFit" in document.documentElement.style !== false; // If the browser does support object-fit, we don't need to continue - if ("objectFit" in document.documentElement.style !== false && !edgePartialSupport) { + if (objectFitSupport && !edgePartialSupport) { window.objectFitPolyfill = function() { return false }; return; }