QueryPath\CSS\QueryPathEventHandler::find PHP Метод

find() публичный Метод

This is the primary searching method used throughout QueryPath.
public find ( string $filter ) : QueryPathEventHandler
$filter string A valid CSS 3 filter.
Результат QueryPathEventHandler Returns itself.
    public function find($filter)
    {
        $parser = new Parser($filter, $this);
        $parser->parse();
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * This replaces everything that matches the selector with the first value
  * in the current list.
  *
  * This is the reverse of replaceWith.
  *
  * Unlike jQuery, DOMQuery cannot assume a default document. Consequently,
  * you must specify the intended destination document. If it is omitted, the
  * present document is assumed to be tthe document. However, that can result
  * in undefined behavior if the selector and the replacement are not sufficiently
  * distinct.
  *
  * @param string $selector
  *  The selector.
  * @param DOMDocument $document
  *  The destination document.
  * @retval object DOMQuery
  *  The DOMQuery wrapping the modified document.
  * @deprecated Due to the fact that this is not a particularly friendly method,
  *  and that it can be easily replicated using {@see replaceWith()}, it is to be
  *  considered deprecated.
  * @see remove()
  * @see replaceWith()
  */
 public function replaceAll($selector, \DOMDocument $document)
 {
     $replacement = $this->size() > 0 ? $this->getFirstMatch() : $this->document->createTextNode('');
     $c = new QueryPathEventHandler($document);
     $c->find($selector);
     $temp = $c->getMatches();
     foreach ($temp as $item) {
         $node = $replacement->cloneNode();
         $node = $document->importNode($node);
         $item->parentNode->replaceChild($node, $item);
     }
     return QueryPath::with($document, NULL, $this->options);
 }
All Usage Examples Of QueryPath\CSS\QueryPathEventHandler::find