[Webkit-unassigned] [Bug 190031] Creating an image via JavaScript will download both src and srcset

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 9 03:08:52 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=190031

--- Comment #10 from Maciass <maciej-rafalski at o2.pl> ---
(In reply to Gareth from comment #0)
> See the following JavaScript example to create an image:
> 
> > var image = document.createElement( 'img' );
> > image.setAttribute( 'src', 'https://via.placeholder.com/300x100/0e7f00' );
> > image.setAttribute( 'srcset', 'https://via.placeholder.com/400x100/0e7f00 400w' );
> > document.body.appendChild( image );
> In WebKit, both the src and srcset image will be downloaded.
> 
> However, upon setting srcset first, before src, then only the srcset version
> will be downloaded:
> 
> > var image = document.createElement( 'img' );
> > image.setAttribute( 'srcset', 'https://via.placeholder.com/400x100/0e7f00 400w' );
> > image.setAttribute( 'src', 'https://via.placeholder.com/300x100/0e7f00' );
> > document.body.appendChild( image );
> Expected behaviour:
> 
> Only download one correct source, no matter of setAttribute order.
> 
> Tested on Safari 10.1 and 12.0 (iPhone and macOS)
> 
> Possibly related: https://bugs.webkit.org/show_bug.cgi?id=177068

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240609/764cd4b6/attachment.htm>


More information about the webkit-unassigned mailing list