blob: df5fa64c99c2d0199e113fbc776301ba64d2a406 [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src="../../../resources/js-test.js"></script>
<script>
description('This tests that Document implements the ParentNode interface.');
var doc = document.implementation.createDocument('', null, null);
shouldBe('doc.children.length', '0');
shouldBe('doc.childElementCount', '0');
shouldBeNull('doc.firstElementChild');
shouldBeNull('doc.lastElementChild');
doc.appendChild(new Comment('a'));
shouldBe('doc.children.length', '0');
shouldBe('doc.childElementCount', '0');
shouldBeNull('doc.firstElementChild');
shouldBeNull('doc.lastElementChild');
var b = doc.appendChild(doc.createElement('b'));
shouldBe('doc.children.length', '1');
shouldBe('doc.childElementCount', '1');
shouldBe('doc.children[0]', 'b');
shouldBe('doc.firstElementChild', 'b');
shouldBe('doc.lastElementChild', 'b');
doc.appendChild(new Comment('c'));
shouldBe('doc.children.length', '1');
shouldBe('doc.childElementCount', '1');
shouldBe('doc.children[0]', 'b');
shouldBe('doc.firstElementChild', 'b');
shouldBe('doc.lastElementChild', 'b');
</script>