Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing editable state and focus in slotted editable element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="host">
<div contenteditable></div>
</div>
<script>
const text = 'A';
test(() => {
const host = document.querySelector('#host');
const shadowRoot = host.attachShadow({ mode: "open" });
const slot = document.createElement("slot");
shadowRoot.appendChild(slot);
const editable = document.querySelector('div[contenteditable]');
editable.focus();
document.execCommand('insertText', false, text);
editable.blur();
assert_equals(editable.innerText, text);
editable.focus();
document.execCommand('insertText', false, text);
assert_equals(editable.innerText, text + text);
});
</script>
</body>
</html>