already-loaded-image-sync-width.html (717B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Image dimensions are available synchronously after changing src to an already-loaded image</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1797798"> 7 <img id="existing"> 8 <script> 9 let src = "/images/green.png"; 10 let existing = document.getElementById("existing"); 11 async_test(function(t) { 12 let tmp = document.createElement("img"); 13 tmp.src = src; 14 tmp.onload = t.step_func_done(function() { 15 existing.src = src; 16 assert_equals(existing.width, 100); 17 assert_equals(existing.height, 50); 18 }); 19 }); 20 </script>