cee-chen / object-fit-polyfill

A Javascript polyfill for browsers that don't support the object-fit CSS property.
ISC License
496 stars 93 forks source link

Facing issue while using this polyfill in IE-11. #38

Closed dhiraj-paryani closed 6 years ago

dhiraj-paryani commented 6 years ago

Hi, I am using this polyfill with angular 5 project.

When page is getting loaded first time, it is not adding css classess/styles, but if I do some resizing of screen(let's say I open debugger tools), then it is working fine.

cee-chen commented 6 years ago

Hey! When using this polyfill within a SPA/JS framework, you need to hook into the your app's after mount/load lifecycle hook. In React, this is componentDidMount(). I'm not sure what the Angular equivalent is - from their docs, it looks like it might be ngOnInit or ngAfterContentInit.

This polyfill is primarily meant to be used with standard/static served websites, so supporting SPAs is not something it will do out of the box. That is left to devs to implement on their own, via the globally-exposed objectFitPolyfill() command. Hope that helps!