3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
15 var li
= document
.createElement("li");
16 li
.appendChild(document
.createTextNode(str
));
17 var console
= document
.getElementById("console");
18 console
.appendChild(li
);
21 function convertStringToUnicode(string
)
23 var returnValue
= " (character in Unicode value): ";
24 for (var i
= 0; i
< string
.length
; ++i
)
26 returnValue
+= " " + string
.charCodeAt(i
);
31 function assertEqual(test_name
, actual
, expected
)
33 if (actual
!= expected
) {
34 log("==================================");
35 log("FAILED: " + test_name
);
36 var actual_string
= "actual" + convertStringToUnicode(actual
);
37 var expected_string
= "expected" + convertStringToUnicode(expected
);
45 if (window
.testRunner
)
46 testRunner
.dumpAsText();
48 var div
= document
.getElementById("div");
49 var string
= div
.innerHTML
;
50 assertEqual("arabic string", string
, "\u0641\u0642 \u202A\u0643 \u0644 abc \u202C \u0645");
52 var sel
= getSelection();
57 positions
.push({ node
: sel
.extentNode
, begin
: sel
.baseOffset
, end
: sel
.extentOffset
});
58 sel
.modify("move", "right", "character");
59 if (positions
[positions
.length
- 1].node
== sel
.extentNode
&& positions
[positions
.length
- 1].end
== sel
.extentOffset
)
63 for (var i
= 0; i
< positions
.length
; ++i
)
64 log("(" + positions
[i
].begin
+ "," + positions
[i
].end
+ ")");
68 <title>Editing Test
</title>
71 <div contenteditable
id=
"div" class=
"editing">فق ‪ك ل abc
‬ م</div>
72 <ul id=
"console"></ul>