@param string $attributeName
@param string|array $selector

@return bool

@throws ElementNotFoundException
509885
private function hasItemWith($attributeName, $selector)
    {
        $itemsAttributes = $this->getElement('cart_items')->findAll('css', $selector);

        foreach ($itemsAttributes as $itemAttribute) {
            if ($attributeName === $itemAttribute->getText()) {
                return true;
            }
        }

        return false;
    }
1219829
public function _selector($selector = null)
    {
        if ($selector === false) {
            $this->library = null;
        } elseif ($selector instanceof self) {
            $this->library = '$('.$selector.')';
        } else {
            $this->library = '$('.json_encode($selector).')';
        }

        return $this;
    }
62955
protected function checkAttribute(DOMNode $node, Tag $tag, $attrName)
	{
		// Test whether the attribute exists
		if (!isset($tag->attributes[$attrName]))
		{
			if ($this->ignoreUnknownAttributes)
			{
				return;
			}

			throw new UnsafeTemplateException("Cannot assess the safety of unknown attribute '" . $attrName . "'", $node);
		}

		// Test whether the attribute is safe to be used in this content type
		if (!$this->tagFiltersAttributes($tag) || !$this->isSafe($tag->attributes[$attrName]))
		{
			throw new UnsafeTemplateException("Attribute '" . $attrName . "' is not properly sanitized to be used in this context", $node);
		}
	}
1211445
public function not($selector)
    {
        $result = $this->createChildInstance();

        if ($this->length > 0) {
            if (\is_callable($selector)) {
                foreach ($this->nodes as $index => $node) {
                    if (!$selector($node, $index)) {
                        $result->addDomNode($node);
                    }
                }
            } else {
                $selection = self::create($this->document)->find($selector);

                if ($selection->length > 0) {
                    foreach ($this->nodes as $node) {
                        $matched = false;
                        foreach ($selection as $result_node) {
                            if ($result_node->isSameNode($node)) {
                                $matched = true;
                                break 1;
                            }
                        }
                        if (!$matched) {
                            $result->addDomNode($node);
                        }
                    }
                } else {
                    $result->addNodes($this->nodes);
                }
            }
        }

        return $result;
    }
1273027
public function elementShouldBeHidden($selector)
    {
        $session = $this->getSession();
        $page = $session->getPage();
        $element = $page->find('css', $selector);

        if (!$element) {
            throw new ElementNotFoundException($session, 'Element "'.$selector.'"');
        }

        \PHPUnit_Framework_TestCase::assertFalse($element->isVisible());
    }
1226681
public function has( $selector, $key = NULL ){
		$rule = $this->getRuleBySelector( $selector );
		if( $rule )
			return !$key ? TRUE : $rule->has( $key );
		return FALSE;
	}
1139833
public function isMatch($selector){
		return $this->isMatchingTail($selector->getEnd(), $this->depth - 1, count($this->stack[$this->depth - 1]) - 1);
	}
1253685
public function isIndexed($attributeName)
    {
        return parent::isIndexed($attributeName) ||
            $this->getRangeKey()->getPropertyMetadata()->name === $attributeName;
    }
1162932
@SuppressWarnings("unchecked")
    public List<HtmlElement> findAllElementsWithAttribute(String attributeName) {
        return (List<HtmlElement>) htmlPage.getByXPath("//*[@" + attributeName + "]");
    }
1266840
public function removeRuleBySelector( $selector ){
		foreach( $this->rules as $nr => $rule ){
			if( $selector == $rule->getSelector() ){
				unset( $this->rules[$nr] );
				return TRUE;
			}
		}
		return FALSE;
	}
339902
protected static function parse_tag_string ($selector) {
		$attributes = [];
		/**
		 * Attributes processing
		 */
		$pos = mb_strpos($selector, '[');
		if ($pos !== false) {
			$regular_attributes = explode('][', mb_substr($selector, $pos + 1, -1));
			$selector           = mb_substr($selector, 0, $pos);
			foreach ($regular_attributes as &$attr) {
				/**
				 * For attribute without value we just put `true`, as this will be treated as boolean attribute
				 */
				$attr                 = explode('=', $attr, 2);
				$attributes[$attr[0]] = isset($attr[1]) ? $attr[1] : true;
			}
			unset($regular_attributes, $attr);
		}
		/**
		 * Classes processing
		 */
		$pos = mb_strpos($selector, '.');
		if ($pos !== false) {
			$attributes['class'] = trim(str_replace('.', ' ', mb_substr($selector, $pos)));
			$selector            = mb_substr($selector, 0, $pos);
		}
		unset($pos);
		/**
		 * Id and tag determination
		 */
		$selector = explode('#', $selector);
		$tag      = $selector[0];
		/**
		 * Convenient support of custom tags for Web Components
		 *
		 * Allows to write BananaHTML::custom_tag() that will be translated to <custom-tag></custom-tag>
		 */
		if (isset($selector[1])) {
			$attributes['id'] = $selector[1];
		}
		return [$tag, $attributes];
	}
699830
public function addElement($elementName, $content, $attributes = null)
    {
        $this->elements[$elementName]['name'] = $elementName;
        $this->elements[$elementName]['content'] = $content;
        $this->elements[$elementName]['attributes'] = $attributes;
    }
331637
public function parent($selector=null)
    {
        $result = $this->createChildInstance();

        if (isset($this->document) && $this->length > 0) {
            foreach ($this->nodes as $node) {
                if ($node->parentNode) {
                    $result->addDomNode($node->parentNode);
                }
            }

            if ($selector) {
                $result = $result->filter($selector);
            }
        }

        return $result;
    }
413917
public function hasAttribute($attributeName)
    {
        // init
        $result = false;

        // action
        foreach ($this->attributes as $attribute) {
            if ($attribute->Name == $attributeName) {
                $result = true;
                break;
            }
        }

        // --- result ---
        return $result;
    }
824341
public function setAttributes($selector, array $attributes)
    {
        $nodes = $this->get($selector);

        foreach ($nodes as $node) {
            $node->setAttributes($attributes);
        }
    }
637572
protected function &findButton($elementname) {
        $form = $this->_form;
        $buttonar =& $form->getElement('buttonar');
        $elements =& $buttonar->getElements();
        foreach ($elements as $el) {
            if ($el->getName() == $elementname) {
                return $el;
            }
        }
        return null;
    }
251718
public function appendSelector(FileSelector $selector)
    {
        if ($this->isReference()) {
            throw $this->noChildrenAllowed();
        }
        parent::appendSelector($selector);
    }