public function has($expression, $type = Query::TYPE_CSS) { $xpath = new DOMXPath($this->document); $expression = Query::compile($expression, $type); $expression = sprintf('count(%s) > 0', $expression); return $xpath->evaluate($expression); }
public function testHas() { $html = $this->loadFixture('posts.html'); $document = new Document($html, false); $this->assertTrue($document->has('.posts')); $this->assertFalse($document->has('.fake')); }