Chromium Code Reviews| 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 function runTest() { | |
|
esprehn
2014/07/02 21:15:41
onload = function() {
| |
| 8 var iframe = document.getElementById("f"); | |
| 9 var iframeDoc = iframe.contentWindow.document; | |
| 10 | |
| 11 iframeDoc.body.innerHTML = '<picture id="pic">' + | |
| 12 '<source media="(max-width: 90px)" srcset="resources/blue-100-px-square. png"></source>' + | |
| 13 '<source media="(max-width: 120px)" srcset="resources/green-400-px-squar e.png"></source>' + | |
| 14 '</picture>'; | |
| 15 | |
| 16 img = iframeDoc.createElement('img'); | |
| 17 | |
| 18 var first = true; | |
| 19 img.onload = function() { | |
| 20 if (first) { | |
| 21 first = false; | |
| 22 shouldNotBe('-1', 'img.currentSrc.indexOf("green-400")'); | |
| 23 iframe.style.width = '80px'; | |
| 24 } else { | |
| 25 shouldNotBe('-1', 'img.currentSrc.indexOf("blue-100")'); | |
| 26 finishJSTest(); | |
| 27 } | |
| 28 }; | |
| 29 img.onerror = function() { | |
| 30 testFailed('Image should have loaded'); | |
| 31 }; | |
| 32 iframeDoc.getElementById('pic').appendChild(img); | |
| 33 } | |
| 34 </script> | |
| 35 | |
| 36 <body onload="runTest()"> | |
|
esprehn
2014/07/02 21:15:41
Remove <body>.
| |
| 37 <iframe id="f" style="width: 100px;"></iframe> | |
|
esprehn
2014/07/02 21:15:42
id="frame"
| |
| OLD | NEW |