4 https://bugzilla.mozilla.org/show_bug.cgi?id=607584
7 <title>Test for Bug
607584</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=607584">Mozilla Bug
607584</a>
15 <div id=
"content" contenteditable
>
16 <p id=
"foo">Hello world
</p>
19 <script type=
"application/javascript">
21 /** Test for Bug
607584 **/
22 SimpleTest.waitForExplicitFinish();
23 SimpleTest.waitForFocus(function() {
24 var content = document.getElementById(
"content");
26 var sel = getSelection();
27 sel.collapse(document.getElementById(
"foo").firstChild,
5);
28 synthesizeKey(
"KEY_Enter");
29 var paragraphs = content.querySelectorAll(
"p");
30 is(paragraphs.length,
2,
"The paragraph should be split in two");
31 is(paragraphs[
0].textContent,
"Hello",
"The first paragraph should have the correct content");
32 is(paragraphs[
1].textContent,
"\u00A0world",
"The second paragraph should have the correct content");
33 is(paragraphs[
0].getAttribute(
"id"),
"foo",
"The id of the first paragraph should be retained");
34 is(paragraphs[
1].hasAttribute(
"id"), false,
"The second paragraph shouldn't have an ID");