forked from mirrors/gecko-dev
It's currently handling its job with the closest ancestor block which may be non-editable and editing host which is either inline or block. However, the closest block is required for check whether the range won't be extended outside the closest block of the common ancestor of the range and the range is guaranteed that they are in an editing host. Therefore, it's not required if it's outside the editing host. So, comparisons which check whether a node is either/neither editing host or/nor ancestor block can get same result with comparing with the closest one of the editing host or the closest editable block. Differential Revision: https://phabricator.services.mozilla.com/D202697
61 lines
1.7 KiB
HTML
61 lines
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Backspace/Delete in inline editing host which is a shadow root</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="/resources/testdriver-actions.js"></script>
|
|
<script src="../include/editor-test-utils.js"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
addEventListener("load", () => {
|
|
const shadowRoot = document.body.firstChild.attachShadow({mode: "open"});
|
|
const editingHost = document.createElement("span");
|
|
editingHost.setAttribute("contenteditable", "");
|
|
shadowRoot.appendChild(editingHost);
|
|
const utils = new EditorTestUtils(editingHost);
|
|
|
|
promise_test(async t => {
|
|
utils.setupEditingHost("ab[]c");
|
|
await utils.sendBackspaceKey();
|
|
assert_equals(
|
|
editingHost.textContent,
|
|
"ac"
|
|
);
|
|
}, "Backspace at <span contenteditable>ab[]c</span>");
|
|
|
|
promise_test(async t => {
|
|
utils.setupEditingHost("a[]bc");
|
|
await utils.sendDeleteKey();
|
|
assert_equals(
|
|
editingHost.textContent,
|
|
"ac"
|
|
);
|
|
}, "Delete at <span contenteditable>a[]bc</span>");
|
|
|
|
promise_test(async t => {
|
|
utils.setupEditingHost("a[b]c");
|
|
await utils.sendBackspaceKey();
|
|
assert_equals(
|
|
editingHost.textContent,
|
|
"ac"
|
|
);
|
|
}, "Backspace at <span contenteditable>a[b]c</span>");
|
|
|
|
promise_test(async t => {
|
|
utils.setupEditingHost("a[b]c");
|
|
await utils.sendDeleteKey();
|
|
assert_equals(
|
|
editingHost.textContent,
|
|
"ac"
|
|
);
|
|
}, "Delete at <span contenteditable>a[b]c</span>");
|
|
}, {once: true});
|
|
</script>
|
|
</head>
|
|
<body><div></div></body>
|
|
</html>
|