-
Notifications
You must be signed in to change notification settings - Fork 92
Initialise polyfill repeatedly #27
Comments
Hey, thanks for reporting. Indeed this seems to be a bug as the polyfill should react to newly loaded images through the MutationObserver. I’ll try to have a look as soon as possible. Do you by any chance have a demo somewhere? If you want to keep this private, you can also send me an email. :) |
I've uploaded a slightly stripped down version of what I'm working with here: http://greysadventures.com/objectfitexample/ I've had the issue on all versions of IE and older Firefox. Both of them also freeze up for a substantial amount of time whilst applying the polyfill. If there's a reason for that too then it'd be great to know how to speed it up some. |
Hey, what does preload JavaScript do? Because I’m seeing an error |
In other words: Can you try to figure out if this works as expected when you load everything in order and don’t alter JS loading behavior? Trying to track the issue down now. |
The preload JS is just Modernizr, to my memory. (It's called "preload" as I bundle my scripts with Gulp, and that's the catch-all term I use for all has-to-be-in-the-head stuff.) Regarding "foreign frames", could this apply to YouTube embeds? These are injected into the DOM when they're needed, but don't exist otherwise. |
Oh, that YouTube embeds indeed could be the issue. Would you be keen to test if it works (or at least doesn’t output the message in IE’s console) then? |
I've quickly stripped out the code responsible for the embeds (on the page linked above), however the error is still occurring. |
I was having this issue on IE 9-10-11. window.objectFit.listen = function(){};
window.objectFit.polyfill({
selector: 'img[data-object-fit-contain]',
fittype: 'contain',
disableCrossDomain: 'true'
});
// …later, after injecting new fragment in DOM:
window.objectFit.process({
selector: '.Lightbox img[data-object-fit-contain]',
replacedElements: document.querySelectorAll('.Lightbox img[data-object-fit-contain]'),
fittype: 'contain',
disableCrossDomain: 'true'
}); Hope this helps. |
Less of an issue, more of a support request.
I'm currently trying to implement the polyfill on a website that uses infinite-scroll and I need some method of re-running the polyfill every time new content is loaded in. The first initialisation works great, but does not affect the newly loaded content.
I've tried calling
objectFit.polyfill()
repeatedly, however it returns the errorCan't execute code from a freed script
, which is apparently related to the use of iframes within the polyfill.If there's some way of being able to run the polyfill several times without encountering this issue?
Thanks!
The text was updated successfully, but these errors were encountered: