-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
DomCrawlerFeatureHelp wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.
Description
Can you please add closest()
to DomCrawler?
http://james.padolsey.com/jquery/#v=2.1.3&fn=jQuery.fn.closest
This is pseudo-code, not tested:
public function closest($selector)
{
if (!count($this)) {
throw new \InvalidArgumentException('The current node list is empty.');
}
$node = $this->getNode(0);
while ($node = $node->parentNode) {
if (XML_ELEMENT_NODE === $node->nodeType) {
$parent = $this->createSubCrawler($node)->filter($selector);
if ($parent->count()) {
return $parent;
}
}
}
return null;
}
AlexeyKosov, tinpansoul, apfelbox, K4T, ReenExe and 12 more
Metadata
Metadata
Assignees
Labels
DomCrawlerFeatureHelp wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.