0
0
Fork 0

Add object-fit polyfill for Edge (#4182)

This commit is contained in:
unarist 2017-07-14 08:59:34 +09:00 committed by Eugen Rochko
parent a9067167bb
commit eeb5923e89
5 changed files with 74 additions and 3 deletions

View file

@ -1,2 +1,5 @@
import 'intersection-observer';
import 'requestidlecallback';
import objectFitImages from 'object-fit-images';
objectFitImages();

View file

@ -20,11 +20,12 @@ function loadPolyfills() {
);
// Latest version of Firefox and Safari do not have IntersectionObserver.
// Edge does not have requestIdleCallback.
// Edge does not have requestIdleCallback and object-fit CSS property.
// This avoids shipping them all the polyfills.
const needsExtraPolyfills = !(
window.IntersectionObserver &&
window.requestIdleCallback
window.requestIdleCallback &&
'object-fit' in (new Image()).style
);
return Promise.all([