blob: f1d79be80467df4e0eb7112bf84f9d1b31885120 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<script>
function onLoad() {
const data = document.querySelector("data");
const source = document.querySelector("source");
// For emulating the traditional behavior, collapse Selection to end of the
// <data> which is the deepest last child (and a container) of the <body>.
getSelection().collapse(data, data.childNodes.length);
source.appendChild(
document.body.firstChild // The invisible text node
);
getSelection().setBaseAndExtent(
data.appendChild(source),
0,
source,
1
);
document.querySelector("audio")
.addEventListener("DOMCharacterDataModified", () => {
getSelection().removeAllRanges()
});
document.execCommand("delete");
}
</script>
<body onload="onLoad()">
<audio>
<li contenteditable>
<data>
<source>
|