3 <script src=
"../../resources/js-test.js"></script>
12 <p id=
"description"></p>
13 <div id=
"threeChildren">
14 <p>a
</p><p>b
</p><p>c
</p>
18 <div id=
"console"></div>
20 description("Check if replacing innerHTML handles :last-child properly.");
22 x
.innerHTML
= "<p>1</p><p>2</p><p>3</p>";
27 debug("Replacing three children.");
28 replace(document
.getElementById("threeChildren"));
29 element
= document
.getElementById("threeChildren").firstChild
;
30 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(0, 0, 255)'");
31 element
= element
.nextSibling
;
32 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(0, 0, 0)'");
33 element
= element
.nextSibling
;
34 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(128, 0, 128)'");
36 debug("Replacing one child.");
37 replace(document
.getElementById("oneChild"));
38 element
= document
.getElementById("oneChild").firstChild
;
39 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(0, 0, 255)'");
40 element
= element
.nextSibling
;
41 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(0, 0, 0)'");
42 element
= element
.nextSibling
;
43 shouldBe("getComputedStyle(element).getPropertyValue('color')", "'rgb(128, 0, 128)'");
45 document
.getElementById("threeChildren").innerHTML
= "";
46 document
.getElementById("oneChild").innerHTML
= "";