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".
This commit is contained in:
Anthony Ramine 2016-03-01 03:12:44 +01:00
parent 802abf4247
commit 186218b265
2 changed files with 5 additions and 11 deletions

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);