Auto merge of #9816 - nox:node-replacechild, r=Ms2ger

Fix the Node.replaceChild tests

That method first does "if node is a host-including inclusive ancestor of parent,
throw a HierarchyRequestError" and only then "if child’s parent is not parent,
throw a NotFoundError exception".

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9816)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-01 14:01:18 +05:30
commit f7db68eff7
2 changed files with 5 additions and 11 deletions

View file

@ -1,5 +0,0 @@
[Node-replaceChild.html]
type: testharness
[If child's parent is not the context node, a NotFoundError exception should be thrown]
expected: FAIL

View file

@ -36,15 +36,9 @@ test(function() {
assert_throws("NotFoundError", function() {
a.replaceChild(b, c);
});
assert_throws("NotFoundError", function() {
a.replaceChild(a, c);
});
assert_throws("NotFoundError", function() {
a.replaceChild(b, a);
});
assert_throws("NotFoundError", function() {
a.replaceChild(a, a);
});
}, "If child's parent is not the context node, a NotFoundError exception should be thrown")
test(function() {
var nodes = [
@ -67,6 +61,11 @@ test(function() {
test(function() {
var a = document.createElement("div");
var b = document.createElement("div");
assert_throws("HierarchyRequestError", function() {
a.replaceChild(a, a);
});
a.appendChild(b);
assert_throws("HierarchyRequestError", function() {
a.replaceChild(a, b);