object-fit icon indicating copy to clipboard operation
object-fit copied to clipboard

Not working in IE11

Open halcarleton opened this issue 10 years ago • 8 comments

Just tried this out in IE11 and it is not working. It looks like the issue is that <x-object-fit> has it's parent container's styling applied to it.

Here's the code:

HTML

<div class="img_container img_container-portrait">
  <img class="img-cover" src="https://placeimg.com/640/480/any" alt="" />
</div>

CSS

body {box-sizing: border-box;}
*, *::before, *::after {position: relative;box-sizing: inherit;}

.img-cover {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.img_container {
  width: 50%;
  max-width: 25rem;
  margin: 5rem auto;
  overflow: hidden;
  border: 2px solid #313131;
}

.img_container-portrait::before {
  content: '';
  display: block;
  padding-top: 130%;
}

JS

window.objectFit.polyfill({
  selector: '.img-cover',
  fittype: 'cover',
  disableCrossDomain: 'false'
});

Here is the resulting html:

<div class="img_container img_container-portrait">
  <x-object-fit class="x-object-fit-cover" style="margin: 5rem auto; border: 2px solid rgb(49, 49, 49); border-image: none; width: 50%; overflow: hidden; max-width: 25rem;">
  <img class="x-object-fit-taller" alt="" src="https://placeimg.com/640/480/any" data-x-object-relation="taller">
  </x-object-fit>
</div>

You can see that <x-object-fit> has the parent's styling in it's style attribute.

JSFiddle Example

halcarleton avatar Jul 01 '15 11:07 halcarleton

+1 Is anyone working on this?

m00s avatar Aug 31 '15 19:08 m00s

:+1:

MadLittleMods avatar Sep 02 '15 16:09 MadLittleMods

Would love this too!

guerreit avatar Sep 18 '15 16:09 guerreit

+1

stephenjwatkins avatar Sep 25 '15 15:09 stephenjwatkins

+1 for IE10 and IE11.

mmikkel avatar Oct 02 '15 11:10 mmikkel

+1

ZhelinCheng avatar Jan 06 '17 05:01 ZhelinCheng

+1

Flavour86 avatar Aug 01 '17 03:08 Flavour86

I recommend archiving this project. Other solutions have better support and it is irritating when there are multiple polyfills (come on devs, GitHub is actually for collaboration ;-) ) and you have to decide which one to use.

DanielRuf avatar Jan 26 '18 11:01 DanielRuf