Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /selection/caret/editing-host-has-only-invisible-br.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html class="reftest-wait">
<head>
<meta charset="utf-8">
<title>Caret should be rendered in the editing host which has no visible non-anonymous content</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="match" href="editing-host-has-only-invisible-br-ref.html">
<style>
div[contenteditable]::after {
content: "placeholder text";
}
</style>
<script>
"use strict";
addEventListener("load", async () => {
const editingHost = document.querySelector("div[contenteditable]");
document.activeElement?.blur();
const waitForFocus = new Promise(resolve =>
editingHost.addEventListener("focus", resolve, {once: true})
);
editingHost.focus();
await waitForFocus;
document.documentElement.removeAttribute("class");
}, {once: true});
</script>
</head>
<body>
<div contenteditable><br style="display:none"></div>
</body>
</html>