REOPENED 264657
cloneNode in safari waste network resources if the node includes an img tag in a picture tag
https://bugs.webkit.org/show_bug.cgi?id=264657
Summary cloneNode in safari waste network resources if the node includes an img tag i...
Muka
Reported 2023-11-10 23:21:51 PST
When cloneNode(true) is executed on a node including an img tag included in a picture tag, the source written in an img tag will be loaded, in spite of a source tag above. This behavior doesn't occur on chrome. The code below is minimal example. <!DOCTYPE html> <html> <body> <picture id="photo"> <source srcset="./photo.webp" type="image/webp"> <img src="./photo.jpg" alt="photo"> </picture> <div id="container"></div> <script> const photo = document.getElementById("photo"); const clonedPhoto =photo.cloneNode(true); document.getElementById('container').appendChild(clonedPhoto); </script> </body> </html> This is a bug? Versions: OS: Apple M1 13.4.1 (c)(22F770820d)(※This behavior occurs on iPhone, too.) Safari: 16.5.2 (18615.2.9.11.10)
Attachments
testcase.html (574 bytes, text/html)
2023-11-20 18:44 PST, Karl Dubost
no flags
rendering in safari, firefox, chrome (486.81 KB, image/png)
2023-11-20 18:45 PST, Karl Dubost
no flags
Alexey Proskuryakov
Comment 1 2023-11-13 16:44:52 PST
*** This bug has been marked as a duplicate of bug 61452 ***
Muka
Comment 2 2023-11-13 17:08:23 PST
(In reply to Alexey Proskuryakov from comment #1) > > *** This bug has been marked as a duplicate of bug 61452 *** I think that this bug is not duplicate of bug 61452. bug 61452 says " document.documentElement.cloneNode(true) causes resources to be downloaded again". This bug report says that cloneNode(true) causes network requests(i.e., images in img tags in picture tag) that would normally never occur.
Radar WebKit Bug Importer
Comment 3 2023-11-17 23:22:12 PST
Karl Dubost
Comment 4 2023-11-20 18:44:49 PST
Created attachment 468696 [details] testcase.html The test
Karl Dubost
Comment 5 2023-11-20 18:45:59 PST
Created attachment 468697 [details] rendering in safari, firefox, chrome Safari reloads the resource while other browsers ignore.
Note You need to log in before you can comment on or make changes to this bug.