<!DOCTYPE html>
<iframe id="iframe" style="width: 100px; height: 100px; will-change: transform; position: absolute; top: 50px; left: 50px" frameBorder=0 srcdoc="<div></div>"></iframe>
<script>
    var selection = getSelection();

    selection.setBaseAndExtent(document.querySelector("#iframe"), 0, document.querySelector("#iframe"), 1);
</script>
