You are here

public function QueryPathCssEventHandler::attributeNS in QueryPath 7.2

Same name and namespace in other branches
  1. 6 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::attributeNS()
  2. 7.3 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::attributeNS()

Overrides CssEventHandler::attributeNS

1 call to QueryPathCssEventHandler::attributeNS()
QueryPathCssEventHandler::lang in QueryPath/CssEventHandler.php

File

QueryPath/CssEventHandler.php, line 256

Class

QueryPathCssEventHandler

Code

public function attributeNS($lname, $ns, $value = NULL, $operation = CssEventHandler::isExactly) {
  $matches = $this
    ->candidateList();
  $found = new SplObjectStorage();
  if (count($matches) == 0) {
    $this->matches = $found;
    return;
  }
  $matches
    ->rewind();
  $e = $matches
    ->current();
  $uri = $e
    ->lookupNamespaceURI($ns);
  foreach ($matches as $item) {
    if ($item
      ->hasAttributeNS($uri, $lname)) {
      if (isset($value)) {
        if ($this
          ->attrValMatches($value, $item
          ->getAttributeNS($uri, $lname), $operation)) {
          $found
            ->attach($item);
        }
      }
      else {
        $found
          ->attach($item);
      }
    }
  }
  $this->matches = $found;
  $this->findAnyElement = FALSE;
}