summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/adopt-from-image-document.html
blob: 30729fc81cb270fdaf611005eafa209b9281d810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!doctype html>
<title>Adopt img from image document</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-img-element">
<link rel="match" href="document-base-url-ref.html">
<!-- Counteract any style added by the image document -->
<style>img { width: initial; height: initial; }</style>
<iframe></iframe>
<script>
  var iframe = document.querySelector('iframe');
  iframe.onload = function() {
    let img = iframe.contentDocument.body.firstChild;
    document.body.appendChild(img);
    iframe.remove();
  };
  iframe.src = 'resources/cat.jpg';
</script>