3 <title>Test for bug
455992</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
8 <script class=
"testbody" type=
"application/javascript">
11 var e = document.getElementById(id);
16 function setupIframe(id) {
17 var e = document.getElementById(id);
18 var doc = e.contentDocument;
19 doc.body.innerHTML = String.fromCharCode(
10) + '
<span id=
"' + id + '_span" style=
"border:1px solid blue" contenteditable=
"true">X
</span>' + String.fromCharCode(
10);
20 e = doc.getElementById(id +
"_span");
25 function test_begin_bs(e) {
26 const msg =
"BACKSPACE at beginning of contenteditable inline element";
27 var before = e.parentNode.childNodes[
0].nodeValue;
28 sendKey(
"back_space");
29 is(e.parentNode.childNodes[
0].nodeValue, before, msg +
" with id=" + e.id);
30 is(e.innerHTML,
"X", msg +
" with id=" + e.id);
33 function test_begin_space(e) {
34 const msg =
"SPACE at beginning of contenteditable inline element";
35 var before = e.parentNode.childNodes[
0].nodeValue;
37 is(e.parentNode.childNodes[
0].nodeValue, before, msg +
" with id=" + e.id);
38 is(e.innerHTML,
" X", msg +
" with id=" + e.id);
41 function test_end_delete(e) {
42 const msg =
"DEL at end of contenteditable inline element";
43 var before = e.parentNode.childNodes[
2].nodeValue;
46 is(e.parentNode.childNodes[
2].nodeValue, before, msg +
" with id=" + e.id);
47 is(e.innerHTML,
"X", msg +
" with id=" + e.id);
50 function test_end_space(e) {
51 const msg =
"SPACE at end of contenteditable inline element";
52 var before = e.parentNode.childNodes[
2].nodeValue;
55 is(e.parentNode.childNodes[
2].nodeValue, before, msg +
" with id=" + e.id);
58 SpecialPowers.getBoolPref(
"editor.white_space_normalization.blink_compatible") || e.tagName ==
"SPAN"
61 msg +
" with id=" + e.id
65 test_begin_bs(select(
"t1"));
66 test_begin_space(select(
"t2"));
67 test_end_delete(select(
"t3"));
68 test_end_space(select(
"t4"));
69 test_end_space(select(
"t5"));
71 test_begin_bs(setupIframe(
"i1"));
72 test_begin_space(setupIframe(
"i2"));
73 test_end_delete(setupIframe(
"i3"));
74 test_end_space(setupIframe(
"i4"));
79 SimpleTest.waitForExplicitFinish();
80 addLoadEvent(runTest);
84 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=455992">Mozilla Bug
455992</a>
90 <div> <span id=
"t1" style=
"border:1px solid blue" contenteditable=
"true">X
</span> Y
</div>
91 <div> <span id=
"t2" style=
"border:1px solid blue" contenteditable=
"true">X
</span> Y
</div>
92 <div> <span id=
"t3" style=
"border:1px solid blue" contenteditable=
"true">X
</span> Y
</div>
93 <div> <span id=
"t4" style=
"border:1px solid blue" contenteditable=
"true">X
</span> Y
</div>
94 <div> <div id=
"t5" style=
"border:1px solid blue" contenteditable=
"true">X
</div> Y
</div>
96 <iframe id=
"i1" width=
"200" height=
"100" src=
"about:blank"></iframe><br>
97 <iframe id=
"i2" width=
"200" height=
"100" src=
"about:blank"></iframe><br>
98 <iframe id=
"i3" width=
"200" height=
"100" src=
"about:blank"></iframe><br>
99 <iframe id=
"i4" width=
"200" height=
"100" src=
"about:blank"></iframe><br>