Created attachment 310397 [details] Test cases: nodes from documents with and without browsing context Overview: Images created from document without browsing context have incorrect dimension (width=0 and height=0) if not forced (defined with CSS). These images are loaded but not visible. NaturalHeight and naturalWidth are correctly provided (the images are loaded). This issue doesn't happend if the node is imported (Document#importNode) instead of adopted (Document#adoptNode). Steps to Reproduce, with JavaScript: 1. Create a document without browsing context (createHTMLDocument, DOMParser, removed iframe) 2. create image with srcset nodes with innerHTML or write() or createElement(), etc. 3. adopt the image node to the current document 4. append the image node Actual Results: Images are loaded (see web dev tools, load event) but the width and the height are equals 0. If with CSS, dimensions are defined (forced), the image is visible Expected Results: If dimensions are not forced, the image should have dimension match its natural width and height.
Created attachment 310398 [details] Test cases: nodes from documents with and without browsing context (use HTTPS)
<rdar://problem/32277554>
Check my bug report: https://bugs.webkit.org/show_bug.cgi?id=183910 It is closed based on the suggestions here: https://bugzilla.mozilla.org/show_bug.cgi?id=1448110
Hi, We are facing this issue as well, and I could not find any fix in the link you have provided pnparam. Is there any way to make sure that srcset is properly honored when a node is added through a fragment or DOMParser ?
I also stumbled upon this issue. Dynamically adding DOM nodes containing images with srcset will set their dimensions to 0, 0. For my case I was able to work around this by forcing a predefined aspect-ratio, but that is clearly not ideal and not applicable to most contexts.