Пример #1
0
 public function parents($selector = null)
 {
     $parents = $this->wrappedQuery->parents();
     if ($selector === null) {
         return $this->createQuery($parents);
     }
     $matchingParents = array();
     foreach ($parents as $parent) {
         if ($this->matcher->matches($parent->get(0), $selector)) {
             $matchingParents[] = $parent->get(0);
         }
     }
     return $this->createQuery(qp($matchingParents));
 }
 private function matchesSelector(DOMNode $node, $selector)
 {
     $matcher = new CssSelectorMatcher();
     return $matcher->matches($node, $selector);
 }