<div id="rtl" contenteditable="true"dir="rtl">
<p id="r1">התרגום האחרון שפיתחנו הוא עבור Firefox 3.5.6.</p>
<p id="r2">קראו את הערות ההפצה (אנגלית) להוראות ורשימת בעיות ידועות.</p>
</div>
<!-- Special characters: لا is actually two characters, while تَ should be
treated as one character. -->
<div id="special" contenteditable="true">
<p id="s1">a لا b تَ c</p>
</div>
function isOrIsParent(actual, expected, msg) {
// actual should be expected or actual's parent node should be expected.
msg += " Expected " + actual + " or " + actual.parentNode + " to be " + expected + ".";
// If nothing is focused, selection.modify() should silently fail.
sel.removeAllRanges();
sel.modify("move", "forward", "character");
// Now focus our first div and put the cursor at the beginning of p1.
$("c").focus();
sel.collapse($("p1"), 0);
// We're intentionally inconsistent with the capitalization of "move",
// "extend", etc. below to test the case-insensitivity of modify().
// If we move backward, selection.modify() shouldn't do anything, since we're
// already at the beginning of the frame.
isAt("p1", 0, "p1", 0, "test 0a");
sel.modify("Move", "Backward", "Character");
isAt("p1", 0, "p1", 0, "test 0b");
// After this move, the cursor should be at the second character of p1
sel.modify("Move", "Forward", "Character");
isAt("p1", 1, "p1", 1, "test 1");
// Select the first character in p1
sel.collapse($("p1"), 0);
sel.modify("Extend", "Forward", "Character");
isAt("p1", 0, "p1", 1, "test 2");
sel.modify("Move", "Forward", "Character");
isAt("p1", 2, "p1", 2, "test 2a");
// Select all of p1, then move the selection forward one character a few
// times.
sel.collapse($("p1"), 0);
sel.extend($("p1"), 1);
sel.modify("move", "forward", "character");
isAt("p2", 0, "p2", 0, "test 3a");
sel.modify("move", "forward", "character");
isAt("p2", 1, "p2", 1, "test 3b");
// Put the cursor at the beginning of p3, then extend forward one line.
// Now go back twice and forward once. Focus should now be at the end of p3.
sel.collapse($("p3"), 0);
sel.modify("Extend", "Forward", "Line");
sel.modify("extend", "backward", "character");
sel.modify("extend", "backward", "character");
sel.modify("extend", "forward", "character");
isAt("p3", 0, "p3", 14, "test 4");
// Put the cursor at the beginning of p3, then go forward a few words
sel.collapse($("p3"), 0);
sel.modify("Move", "Forward", "Word");
isAt("p3", 4, "p3", 4, "test 4a");
sel.modify("move", "forward", "word");
// Go back and forward so the indexes are correct.
sel.modify("move", "backward", "character");
sel.modify("move", "forward", "character");
isAt("p3", 14, "p3", 14, "test 4b");
// Test the lineboundary granularity
sel.collapse($("p3"), 0);
sel.modify("Move", "Forward", "Lineboundary");
// Go back and forward so the indexes are correct.
sel.modify("move", "Backward", "character");
sel.modify("move", "forward", "character");
isAt("p3", 14, "p3", 14, "test 5");
// Put the cursor at the left edge of the first line so that when we go up
// and down, where we end up doesn't depend on how the characters line up.
sel.collapse($("l1"), 0);
SpecialPowers.wrap(sel).caretBidiLevel = 1;
sel.modify("move", "left", "lineboundary");
isAt("l1", 0, "l1", 0, "test 9a");
sel.modify("move", "forward", "Line");
// Offset becomes non-zero because the line boundary was in the middle of the
// line. See bug 1667129
isAt("l2", 3, "l2", 3, "test 9b");
sel.modify("extend", "backward", "Line");
// Going back to the beginning of the previous line
isAt("l2", 3, "l1", 0, "test 9c");
// Same test as above, now with absolute directions.
sel.collapse($("l1"), 0);
SpecialPowers.wrap(sel).caretBidiLevel = 1;
sel.modify("move", "left", "lineboundary");
isAt("l1", 0, "l1", 0, "test 10a");
sel.modify("move", "right", "line");
// Also bug 1667129
isAt("l2", 3, "l2", 3, "test 10b");
sel.modify("extend", "left", "line");
isAt("l2", 3, "l1", 0, "test 10c");
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 und die Messung sind noch experimentell.