public function getTargetNodes($selector, \DOMNode $context = NULL)
{
if ($nodes = $this->getNodeList($selector)) {
return $nodes;
} elseif (is_string($selector)) {
$result = $this->getOwner()->xpath($this->getOwner()->prepareSelector($selector, Nodes::CONTEXT_SELF), $context);
if (!$result instanceof \Traversable) {
throw new \InvalidArgumentException('Given selector did not return an node list.');
}
return iterator_to_array($result);
}
throw new \InvalidArgumentException('Invalid selector');
}