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
);
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
14 const selection
= self
.getSelection();
15 selection
.collapse(document
.body
, document
.body
.childNodes
.length
);
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();