public function parent() { if ($this->node->parentNode === null) { return null; } if ($this->node->parentNode instanceof \DOMDocument) { return new Document($this->node->parentNode); } return new Element($this->node->parentNode); }
public function testParentWithoutOwner() { $element = new Element(new \DOMElement('span', 'hello')); $this->assertNull($element->parent()); }