1626002.html (991B)
1 <html> 2 <head> 3 <script> 4 addEventListener("load", () => { 5 const anchor = document.createElement("a"); 6 const b = document.createElement("b"); 7 const c = document.createElement("c"); 8 document.documentElement.appendChild(anchor); 9 anchor.appendChild(b); 10 b.setAttribute("contenteditable", "true"); 11 // For emulating the traditional behavior, collapse Selection to end of the 12 // <body> which must be empty because this test appends the new elements after 13 // the <body>. 14 const selection = self.getSelection(); 15 selection.collapse(document.body, document.body.childNodes.length); 16 b.appendChild(c); 17 c.outerHTML = '<s contenteditable="false"><b contenteditable="true">'; 18 selection.setBaseAndExtent(document, 0, document.documentElement, 0); 19 const range = selection.getRangeAt((260523900 % selection.rangeCount)); 20 selection.selectAllChildren(b); 21 range.collapse(false); 22 range.setEndAfter(document.documentElement); 23 range.extractContents(); 24 }); 25 </script> 26 </head> 27 </html>