lastChild() 공개 메소드

public lastChild ( ) : Element | null
리턴 Element | null
예제 #1
0
 public function testLastChild()
 {
     $html = '<ul><li>One</li><li>Two</li><li>Three</li></ul>';
     $document = new Document($html, false);
     $list = $document->first('ul');
     $this->assertEquals($list->getNode()->lastChild, $list->lastChild()->getNode());
     $list = new Element('ul');
     $this->assertNull($list->lastChild());
     // with text nodes
     $html = '<p>Foo <span>Bar</span> Baz</p>';
     $document = new Document($html, false);
     $paragraph = $document->first('p');
     $lastChild = $paragraph->getNode()->lastChild;
     $this->assertEquals($lastChild, $paragraph->lastChild()->getNode());
 }