Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prop updates are not correctly handled with Picturefill #36

Open
EmilEriksen opened this issue Jun 18, 2020 · 2 comments
Open

Prop updates are not correctly handled with Picturefill #36

EmilEriksen opened this issue Jun 18, 2020 · 2 comments

Comments

@EmilEriksen
Copy link

According to the Picturefill website

If you dynamically change the srcset, sizes attributes, or modify source elements, please use this reevaluate option and provide an array or array-like object of your mutated img elements. As an alternative the mutation plugin can be used.

picturefill({
  reevaluate: true,
  elements: [ document.getElementById( "myImg" ) ]
});

I don't believe this is being done at the moment, and I believe it's causing a bug I'm facing where I'm doing exactly that

@braposo
Copy link
Owner

braposo commented Jun 18, 2020

Hey @EmilEriksen are you able to provide a bit more context about the bug you're experiencing?

Is that happening in all browsers or older ones?

We're currently just using the simplest call to picturefill so that's definitely not supported at the moment but I'm just trying to understand and recreate that bug you've mentioned.

@EmilEriksen
Copy link
Author

Yes, of course. I've created an example here. If you open it in a modern browser it'll play a slideshow of images but in IE 11 nothing happens because Picturefill is not being told that the srcset has been updated. If you look in the DOM explorer you can see that the srcset attribute is updated but src is not. This should happen in all older browsers that require Picturefill to work but I've only tested it in IE 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants