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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 27 01:37:23 PDT 2018


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

            Bug ID: 190031
           Summary: Creating an image via JavaScript will download both
                    src and srcset
           Product: WebKit
           Version: Safari 11
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Images
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: thewelsh+webkit at gmail.com

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/20180927/44451dd1/attachment.html>


More information about the webkit-unassigned mailing list