/** Test for Bug 570144 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
function try2split(list) { var editor = list.hasAttribute("contenteditable")
? list : list.querySelector("*[contenteditable]");
editor.focus();
// put the caret at the end of the paragraph var selection = window.getSelection();
if (editor.nodeName.toLowerCase() == "p")
selection.selectAllChildren(editor);
else
selection.selectAllChildren(editor.querySelector("p"));
selection.collapseToEnd();
// simulate a [Enter] keypress
synthesizeKey("KEY_Enter");
}
function testSection(element, context, shouldCreateLI, shouldCreateP) { var nbLI = shouldCreateLI ? 2 : 1; // number of expected list items var nbP = shouldCreateP ? 2 : 1; // number of expected paragraphs
function message(nodeName, dup) {
return context + ":[Return] should " + (dup ? "" : "not ")
+ "create another <" + nodeName + ">.";
} var msgP = message("p", shouldCreateP); var msgLI = message("li", shouldCreateLI); var msgDT = message("dt", shouldCreateLI); var msgDD = message("dd", false);
function runTests() {
testSection(document.getElementById("test1"), "editable paragraph in list item", false, false);
testSection(document.getElementById("test2"), "paragraph in editable list item", false, true);
testSection(document.getElementById("test3"), "paragraph in editable list", true, false);
/* Note: concerning #test3, it would be preferrable that [Return] creates
* another paragraph in another list item (i.e. last argument = 'true').
* Currently it just creates an empty list item, which is acceptable.
*/
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>
¤ Dauer der Verarbeitung: 0.31 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.