mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
44 lines
1.4 KiB
HTML
44 lines
1.4 KiB
HTML
<html>
|
|
<head>
|
|
<script src="harness.js"></script>
|
|
</head>
|
|
<body>
|
|
<p>This is the character data</p>
|
|
</body>
|
|
<script>
|
|
var a = document.getElementsByTagName('p')[0].childNodes[0];
|
|
is(a.data, "This is the character data");
|
|
// append test utf8
|
|
a.appendData(", append more 資料,測試資料");
|
|
is(a.data, "This is the character data, append more 資料,測試資料");
|
|
|
|
// length test utf8
|
|
is(a.length, 47);
|
|
|
|
// insert test non-utf8
|
|
a.insertData(26, " test");
|
|
is(a.data, "This is the character data test, append more 資料,測試資料");
|
|
// insert test utf8
|
|
a.insertData(48, "更多");
|
|
is(a.data, "This is the character data test, append more 資料,更多測試資料");
|
|
|
|
// delete test non-utf8
|
|
a.deleteData(40, 5);
|
|
is(a.data, "This is the character data test, append 資料,更多測試資料");
|
|
// delete test utf8
|
|
a.deleteData(45, 2);
|
|
is(a.data, "This is the character data test, append 資料,更多資料");
|
|
|
|
// replace test non-utf8
|
|
a.replaceData(33, 6, "other");
|
|
is(a.data, "This is the character data test, other 資料,更多資料");
|
|
// replace test non-utf8
|
|
a.replaceData(44, 2, "文字");
|
|
is(a.data, "This is the character data test, other 資料,更多文字");
|
|
|
|
// substring test non-utf8
|
|
is(a.substringData(12, 4), "char");
|
|
// substring test utf8
|
|
is(a.substringData(39, 2), "資料");
|
|
</script>
|
|
</html>
|