mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Auto merge of #6222 - Ms2ger:characterdata, r=nox
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6222) <!-- Reviewable:end -->
This commit is contained in:
commit
99b79fc248
3 changed files with 10 additions and 34 deletions
|
@ -113,12 +113,6 @@
|
|||
"url": "/_mozilla/mozilla/caption.html"
|
||||
}
|
||||
],
|
||||
"mozilla/characterdata.html": [
|
||||
{
|
||||
"path": "mozilla/characterdata.html",
|
||||
"url": "/_mozilla/mozilla/characterdata.html"
|
||||
}
|
||||
],
|
||||
"mozilla/child_reparenting.html": [
|
||||
{
|
||||
"path": "mozilla/child_reparenting.html",
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>This is the character data</p>
|
||||
</body>
|
||||
<script>
|
||||
test(function() {
|
||||
var a = document.getElementsByTagName('p')[0].childNodes[0];
|
||||
a.data = "This is the character data test, append 資料,更多資料";
|
||||
|
||||
// replace test non-utf8
|
||||
a.replaceData(33, 6, "other");
|
||||
assert_equals(a.data, "This is the character data test, other 資料,更多資料");
|
||||
// replace test non-utf8
|
||||
a.replaceData(44, 2, "文字");
|
||||
assert_equals(a.data, "This is the character data test, other 資料,更多文字");
|
||||
|
||||
// substring test non-utf8
|
||||
assert_equals(a.substringData(12, 4), "char");
|
||||
// substring test utf8
|
||||
assert_equals(a.substringData(39, 2), "資料");
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -7,7 +7,6 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// TODO: non-ASCII strings
|
||||
function testNode(create, type) {
|
||||
test(function() {
|
||||
var node = create()
|
||||
|
@ -101,6 +100,16 @@ function testNode(create, type) {
|
|||
assert_equals(node.substringData(0, -1), "test")
|
||||
assert_equals(node.substringData(0, -0x100000000 + 2), "te")
|
||||
}, type + ".substringData() with negative count")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "This is the character data test, other 資料,更多文字"
|
||||
|
||||
assert_equals(node.substringData(12, 4), "char")
|
||||
assert_equals(node.substringData(39, 2), "資料")
|
||||
}, type + ".substringData() with non-ASCII data")
|
||||
}
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue