blob: 779998b4f85bca3d343509eb2d1c385696604fec (
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
29
30
31
|
<style>
:not(cursor) {
column-count: 1;
user-select: none;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", () => {
window.getSelection().modify("move", "backward", "line")
const interval = setInterval(() => {
const m = new MutationObserver(() => {
let x = document.getSelection().getRangeAt(0)
a.appendChild(document.createElement("optgroup"))
try {
x.comparePoint(document.activeElement, 1)
} catch (error) {
clearInterval(interval)
return
}
})
m.observe(b, {attributes: true})
b.setAttribute("x", "false")
}, 100)
})
</script>
<hr contenteditable="true">
<shadow id="a">
<select autofocus="autofocus">a</select>
<div id="b">a</div>
|