2017-10-05 08:23:12 +03:00
|
|
|
<script>
|
2022-09-22 09:27:37 +03:00
|
|
|
function onLoad() {
|
|
|
|
// For emulating the traditional behavior, collapse Selection to end of the
|
|
|
|
// parent of <embed> (<embed> is not a container, therefore, its parent is the
|
|
|
|
// deepest last child container element of the <body>).
|
|
|
|
getSelection().collapse(
|
|
|
|
document.querySelector("embed").parentElement,
|
|
|
|
document.querySelector("embed").parentElement.childNodes.length
|
|
|
|
); // Point the <embed>
|
|
|
|
const option = document.querySelector("option");
|
2017-10-05 08:23:12 +03:00
|
|
|
option.addEventListener("click", () => {
|
2022-09-22 09:27:37 +03:00
|
|
|
document.execCommand("forwardDelete");
|
2017-10-05 08:23:12 +03:00
|
|
|
});
|
2022-09-22 09:27:37 +03:00
|
|
|
const li2 = document.getElementById("li2");
|
2017-10-05 08:23:12 +03:00
|
|
|
li2.addEventListener("DOMNodeInserted", () => {
|
|
|
|
option.click();
|
|
|
|
});
|
2022-09-22 09:27:37 +03:00
|
|
|
const select = document.querySelector("select");
|
2017-10-05 08:23:12 +03:00
|
|
|
select.parentElement.setAttribute("onpageshow", "onPageShow()");
|
|
|
|
}
|
|
|
|
|
|
|
|
function onPageShow() {
|
2022-09-22 09:27:37 +03:00
|
|
|
const li1 = document.getElementById("li1");
|
2017-10-05 08:23:12 +03:00
|
|
|
li1.addEventListener("DOMSubtreeModified", () => {
|
2022-09-22 09:27:37 +03:00
|
|
|
document.execCommand("selectAll");
|
|
|
|
document.execCommand("indent");
|
2017-10-05 08:23:12 +03:00
|
|
|
});
|
|
|
|
li1.appendChild(document.createElement("legend"));
|
|
|
|
}
|
|
|
|
</script>
|
2022-09-22 09:27:37 +03:00
|
|
|
<body onload="onLoad()">
|
|
|
|
<select>
|
|
|
|
<option></option>
|
2017-10-05 08:23:12 +03:00
|
|
|
</select>
|
|
|
|
<li id="li1"></li>
|
|
|
|
<ul contenteditable="true">
|
|
|
|
<li id="li2"></li>
|
|
|
|
<embed>a;#2
|