Closed sgb-io closed 8 years ago
Sorry, what do you mean by "auto-detect usage"? Not sure I understand the problem properly.
I have only glanced the source so please feel free to close if I'm wrong, but I think the polyfill is parsing existing styles/stylesheets and elements in an attempt to automatically find where 'object-fit' is used.
That strategy seems like a big overhead for the polyfill to account for whereas we could just call it into action explicitly.
Ah, yes and no. In general you select this as in the mentioned jQuery polyfill but it still needs to parse all the styles to get the css of the current and parent elements as the polyfill injects a new custom element to maintain styles on the images or image container. Disabling this would make the polyfill pointless (okay, it’s pointless anyway thanks to edge dropping support for some JS properties)…
I may be mistaken, but it seems various problems are stemming from attempting to auto-detect usage of
object-fit
?If this is true, wouldn't it make sense to drop that in favour of explicit usage? Like this for example: https://github.com/steveworkman/jquery-object-fit
Seems simpler, and I think it's reasonable to expect people using
object-fit
to be prepared to add polyfill code to their projects.