1644903.html (638B)
1 <script> 2 window.onload = () => { 3 document.execCommand("undo"); 4 } 5 function onToggle() { 6 // For emulating the traditional behavior, collapse Selection to end of the 7 // text node at end of the <details> (<p> is closed before the <details>). 8 const details = document.querySelector("details"); 9 getSelection().collapse(details.lastChild, details.lastChild.length); 10 const link = document.querySelector("link"); 11 document.execCommand("delete"); 12 document.querySelector("iframe").contentDocument.adoptNode(link); 13 } 14 </script> 15 <p contenteditable> 16 <link item=""> 17 <details open ontoggle="onToggle()"> 18 <iframe></iframe> 19 </details></body>