OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <script> |
| 4 var jsTestIsAsync = true; |
| 5 var img; |
| 6 |
| 7 onload = function() { |
| 8 var iframe = document.getElementById('frame'); |
| 9 var iframeDoc = iframe.contentWindow.document; |
| 10 |
| 11 iframeDoc.body.innerHTML = '<img id="srcset" srcset="resources/blue_rect.jpg
75w, resources/image-set-4x.png 120w">'; |
| 12 |
| 13 img = iframeDoc.getElementById('srcset'); |
| 14 |
| 15 var first = true; |
| 16 img.onload = function() { |
| 17 if (first) { |
| 18 first = false; |
| 19 shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1'); |
| 20 shouldBe('img.width', '70'); |
| 21 iframe.style.width = '75px'; |
| 22 shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1'); |
| 23 shouldBe('img.width', '75'); |
| 24 finishJSTest(); |
| 25 } |
| 26 }; |
| 27 img.onerror = function() { |
| 28 testFailed('Image should have loaded'); |
| 29 }; |
| 30 } |
| 31 </script> |
| 32 |
| 33 <iframe id="frame" style="width: 70px;"></iframe> |
OLD | NEW |