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