Setting img src attribute using js resets gif to first frame
Categories
(Core :: Graphics: ImageLib, defect)
Tracking
()
People
(Reporter: gomes.cristiano, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Steps to reproduce:
Set img src parameter using javascript.
Actual results:
The created gif and all preceeding gifs with the same URL get reset to the first frame.
The weird thing is that the gif doesn't get reset when using srcset
I created a small example site:
https://gloomyfrown.github.io/imgtest/
Clicking the "Create img element using src" repeatedly resets the gif, while
"Create img element using srcset" doesn't.
Expected results:
The created gif should start at the same frame as the proceeding gifs with the same URL.
Updated•3 years ago
|
Comment 1•3 years ago
|
||
We have code to reset the animation in nsImageLoadingContent, so it doesn't seem like an accident that we are doing this. I'll have to check the history to see why we are doing this. Safari and Chrome do not reset the animation on src setting.
Updated•3 years ago
|
| Reporter | ||
Comment 2•3 years ago
|
||
There seem to be some more inconsistencies, if i create an img tag and set the src attribute first and the srcset attribute after, all gifs reset and show the image of the src attribute. If i do it the other way around, set srcset first and then src, the gifs don't reset but still show the src image.
Should the order of setting the src and srcset attributes matter in this case?
Example:
https://gloomyfrown.github.io/attribute-order-test/
Comment 3•3 years ago
|
||
May I ask what is the use case that caused you to notice this? Having an idea of where this is important might be helpful.
| Reporter | ||
Comment 4•3 years ago
|
||
This issue occurs when the same animated emotes get repeatedly posted in a twitch.tv chat, the gifs keep reseting.
These emotes are nothing special, just an img element with a src and srcset attribute.
Firefox example
Chrome example
The way chrome handles it seems more reasonable.
Comment 5•3 years ago
|
||
Description
•