anselmh / object-fit

Polyfill (mostly IE) for CSS object-fit property to fill-in/fit-in images into containers.
MIT License
996 stars 92 forks source link

IE11 crashes because of css crawling #31

Closed jonerd closed 9 years ago

jonerd commented 9 years ago

Unfortunately in my project your plugin causes IE11 to crash. My project contains a lot of css-files and since the plugin is crawling all css files it seems to overcharge the browser. Why is it necessary to browse the css, when the plugin is initialized with explicit options like selector: 'img' and fittype: 'cover'? Is there any way to prevent css crawling?

anselmh commented 9 years ago

Hi, i’m sorry this is causing trouble with your site. However, due to the inheritance feature of values in CSS it is necessary to parse the whole CSS. The selector you give is only to set the target but doesn’t limit the CSS parsing. It’s true that this is not ideal but to match the behavior of object-fit as expected this is necessary.

You could either try to minimize your CSS or, try to emulate the behavior of object-fit with SVG.