auto merge of #4928 : yodalee/servo/issue4906-fix-characterdata-substringdata, r=jdm

issue #4906
Fix substringData function, and add a test case for all function in characterdata.
This commit is contained in:
bors-servo 2015-02-27 19:39:58 -07:00
commit 55f7636549
3 changed files with 49 additions and 11 deletions

View file

@ -0,0 +1,44 @@
<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>

View file

@ -132,12 +132,6 @@
[detachedXmlTextNode.wholeText]
expected: FAIL
[detachedForeignComment.length]
expected: FAIL
[detachedXmlComment.length]
expected: FAIL
[paras[0\].previousElementSibling]
expected: FAIL