blob: 1546bb460146748b34ad67d3ae0359db3d603ddd (
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
|
<!DOCTYPE html>
<html>
<head>
<script>
document.addEventListener('DOMContentLoaded', () => {
const table = document.querySelector("table");
// For emulating traditional behavior, collapse Selection to end of the
// text node after the <p> (<table> does not close the <p>).
getSelection().collapse(
document.body.lastChild,
document.body.lastChild.length
);
const paragraph = document.querySelector("p");
document.documentElement.contentEditable = true;
getSelection().setBaseAndExtent(document, 0, document.documentElement, 1);
paragraph.contentEditable = false;
table.insertRow(0);
document.execCommand("forwardDelete");
});
</script>
</head>
<p>
<del>
<button contenteditable>
</button>
<table>
</table>
</del>
</p>
</body>
</html>
|