Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-img-element/adopt-from-image-document.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>Adopt img from image document</title>
<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>