appendChild() public method

Adds new child at the end of the children.
public appendChild ( Element | DOMNode | array $nodes ) : Element
$nodes Element | DOMNode | array The appended child
return Element
コード例 #1
0
ファイル: ElementTest.php プロジェクト: imangazaliev/didom
 public function testAppendChild()
 {
     $list = new Element('ul');
     $this->assertCount(0, $list->find('li'));
     $node = new Element('li', 'foo');
     $list->appendChild($node);
     $this->assertCount(1, $list->find('li'));
     $items = [];
     $items[] = new Element('li', 'bar');
     $items[] = new Element('li', 'baz');
     $list->appendChild($items);
     $this->assertCount(3, $list->find('li'));
 }