appendChild($d->createElement('html')); $d->documentElement->appendChild($d->createElement('body')); $b = $d->body; $b->appendChild($d->createElement('span')); $b->appendChild($d->createTextNode('ook')); // Node::childNodes on Element $childNodes = $d->body->childNodes; $this->assertEquals(2, $childNodes->length); $this->assertSame('SPAN', $childNodes[0]->nodeName); // Node::childNodes on Text $childNodes = $d->body->lastChild->childNodes; $this->assertEquals(0, $childNodes->length); // Try it again to test caching $childNodes = $d->body->lastChild->childNodes; } }