OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | |
3 <script> | 2 <script> |
4 window.targetScaleFactor = 1; | 3 window.targetScaleFactor = 1; |
5 </script> | 4 </script> |
6 <script src="resources/srcset-helper.js"></script> | 5 <script src="resources/srcset-helper.js"></script> |
7 <script src="../../resources/js-test.js"></script> | 6 <script src="../../resources/js-test.js"></script> |
8 <script> | 7 <script> |
9 if (window.testRunner) { | 8 if (window.testRunner) { |
10 testRunner.dumpAsText(); | 9 testRunner.dumpAsText(); |
11 } | 10 } |
12 | |
13 function updateSrc() { | 11 function updateSrc() { |
14 var img = document.getElementById("foo"); | 12 var img = document.getElementById("foo"); |
15 // srcset must be set first, otherwise 'src' is loaded as well | 13 // srcset must be set first, otherwise 'src' is loaded as well |
16 img.srcset = "resources/green-400-px-square.png 2x"; | 14 img.srcset = "resources/green-400-px-square.png 2x"; |
17 img.src = "resources/blue-100-px-square.png" | 15 img.src = "resources/blue-100-px-square.png" |
18 } | 16 } |
19 | |
20 addEventListener("DOMContentLoaded", function() { | 17 addEventListener("DOMContentLoaded", function() { |
21 updateSrc(); | 18 updateSrc(); |
22 }, false); | 19 }, false); |
23 addEventListener("load", function() { | 20 addEventListener("load", function() { |
24 if (internals) | 21 if (internals) |
25 shouldBeFalse('internals.isPreloaded("resources/green-400-px-square.
png")'); | 22 shouldBeFalse('internals.isPreloaded("resources/green-400-px-square.
png")'); |
26 shouldBeTrue('document.getElementById("foo").clientWidth==100'); | 23 shouldBeTrue('document.getElementById("foo").clientWidth==100'); |
27 }, false); | 24 }, false); |
28 </script> | 25 </script> |
29 </head> | 26 <div>This test passes if this img tag below is a blue square when the scale fact
or is 1. |
30 | 27 It ensures that attributes can be changed dynamically from javascript, and t
hat only the correct resource is loaded.</div> |
31 <body id="body"> | 28 <img id="foo"> |
32 <div>This test passes if this img tag below is a blue square when the scale
factor is 1. | |
33 It ensures that attributes can be changed dynamically from javascript, and
that only the correct resource is loaded.</div> | |
34 <img id="foo"> | |
35 </body> | |
36 </html> | |
OLD | NEW |