JSFiddle - React, Tailwind, and code Playground
HTML
<iframe srcdoc="
<div id=a>
From iframe
<script>
// This script will move the current parent <div> to the <iframe>'s parent
// Since it's now in another document, the following script should not be executed nor downloaded
// Still, it's going to be parsed and inserted into the parent DOM
const div = document.getElementById('a');
parent.document.body.append(div);
</script>
<script src='script.js'></script>
</div>"
></iframe>
JavaScript
onload = evt => console.log(document.querySelector("#a").outerHTML);