You are here

protected function QueryPathCssEventHandler::onlyOfType in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::onlyOfType()
  2. 7.2 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::onlyOfType()
1 call to QueryPathCssEventHandler::onlyOfType()
QueryPathCssEventHandler::pseudoClass in QueryPath/CssEventHandler.php

File

QueryPath/CssEventHandler.php, line 888

Class

QueryPathCssEventHandler

Code

protected function onlyOfType() {
  $matches = $this
    ->candidateList();
  $found = new SplObjectStorage();
  foreach ($matches as $item) {
    if (!$item->parentNode) {
      $this->matches = new SplObjectStorage();
    }
    $parent = $item->parentNode;
    $onlyOfType = TRUE;
    foreach ($parent->childNodes as $kid) {
      if ($kid->nodeType == XML_ELEMENT_NODE && $kid->tagName == $item->tagName && $kid !== $item) {
        $onlyOfType = FALSE;
        break;
      }
    }
    if ($onlyOfType) {
      $found
        ->attach($item);
    }
  }
  $this->matches = $found;
}