/** * @param string $id * @throws InvalidArgumentException when id not found * @return boolean */ public function isVisible($id) { $element = $this->getElement($id); $conditions = ["contains(@style, 'display:none')", "contains(@style, 'display: none')", "self::script", "self::head"]; $hidden = $this->xpath->query('./ancestor-or-self::*[' . join(' or ', $conditions) . ']', $element); return $hidden->length == 0; }
/** * @covers ::query * @covers ::onQueryError */ public function testQueryInvalidScope() { $xpath = new SafeXPath($this->document); $this->setExpectedException('InvalidArgumentException', 'Node From Wrong Document'); $xpath->query('//form', new DOMElement('div')); }