blob: 7f4ffd62ebb81e68db8f28a0c2f58b098997ab4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<script>
window.onload = () => {
// For emulating the traditional behavior, collapse Selection to end of the
// <body> (at the text node after the <input>).
getSelection().collapse(document.body, document.body.childNodes.length);
document.execCommand("insertHorizontalRule");
getSelection().collapse(
document.querySelector("b")
);
document.execCommand("forwardDelete");
}
function onFocusChangeOfInput() {
document.getSelection().setPosition(document.querySelector("pre"));
}
</script>
<pre>
<time contenteditable>a|</t>
<input onfocus="onFocusChangeOfInput()" autofocus onblur="onFocusChangeOfInput()">
|