blob: 01091d1736e87b294c3ddf118227d93f129808fe (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>Inert and contenteditable</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#inert">
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable">
<meta assert="assert" content="
Executing an editing command in a node marked as both inert and editable
should have the same result regardless of which ancestors trigger each effect.
Only testing for consistency, the exact result is not interoperable.">
<div id="log"></div>
<div class="wrapper" contenteditable inert>
{<p class="target">target</p>}
</div>
<div class="wrapper" contenteditable>
{<p class="target" inert>target</p>}
</div>
<div class="wrapper" inert>
{<p class="target" contenteditable>target</p>}
</div>
<div class="wrapper">
{<p class="target" contenteditable inert>target</p>}
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const results = [];
const textContents = [];
setup(function() {
const selection = getSelection();
for (let wrapper of document.querySelectorAll(".wrapper")) {
const target = wrapper.querySelector(".target");
selection.collapse(target.firstChild, 3);
results.push(document.execCommand("delete"));
textContents.push(wrapper.textContent.trim());
}
});
function testSameValues(array, description) {
test(function() {
assert_greater_than(array.length, 0, "Array shouldn't be empty");
for (let i = 1; i < array.length; ++i) {
assert_equals(array[i], array[0], `${JSON.stringify(array)} at index ${i}`);
}
}, description);
}
testSameValues(results, "execCommand should return the same value");
testSameValues(textContents, "The resulting textContent should be the same value");
</script>
|