@param string $regex
@param string $attr

@return array
763860
public function images($regex = null, $attr = 'src')
    {
        /**
         * @var \DOMElement $node
         * @var \DOMElement $node2
         */
        $query = $this->_document->getQuery();
        $document = $this->_document;

        $data = [];
        foreach ($this->_nodes as $node) {
            if ($node->nodeName === 'img') {
                $src = $document->absolutizeUrl($node->getAttribute($attr));

                if ($regex && !preg_match($regex, $src)) {
                    continue;
                }

                $data[$node->getNodePath()] = $src;
            } else {
                foreach ($query->xpath("descendant::img[@$attr]", $node) as $node2) {
                    $src = $document->absolutizeUrl($node2->getAttribute($attr));

                    if ($regex && !preg_match($regex, $src)) {
                        continue;
                    }

                    $data[$node2->getNodePath()] = $src;
                }
            }
        }

        return array_values($data);
    }
934274
public function getContentsByAttr($attr, $attr_value) {
        $nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
        
        $contents = [];
        
        foreach ($nodes as $node) {
            array_push($contents, $node->nodeValue);
        }
        
        return $contents;
    }
1272623
public static function css($href, array $attrs = [])
    {
        $attrs = array_merge([
            'type' => 'text/css',
            'rel' => 'stylesheet',
            'href' => $href,
        ],
            $attrs);

        return static::tag('link', null, $attrs);
    }
650545
public function url($attr)
    {
        $data = [];

        foreach ($this->_nodes as $node) {
            $data[] = $this->_document->absolutizeUrl($node->getAttribute($attr));
        }

        return $data;
    }
436864
public function attr($attr) {
		if($this->domnode === null)
			return null;
		return $this->domnode->getAttribute($attr);
	}
508640
function (attrString) {
    var tokens = {};

    // Regex for parsing a css attribute declaration, taken from css-parse:
    // https://github.com/reworkcss/css-parse/blob/7cef3658d0bba872cde05a85339034b187cb3397/index.js#L219
    var regex = /(\*?[-#\/\*\\\w]+(?:\[[0-9a-z_-]+\])?)\s*:\s*(?:\'(?:\\\'|.)*?\'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+[;\s]*/g;
    var match = regex.exec(attrString);
    while (match) {
      // match[0] = entire matching string
      // match[1] = css property
      // Prefix the token to prevent conflicts with existing properties.

      // XXX No `String.trim` on Safari 4. Swap out $.trim if we want to
      // remove strong dep on jquery.
      tokens[' ' + match[1]] = match[0].trim ?
        match[0].trim() : $.trim(match[0]);

      match = regex.exec(attrString);
    }

    return tokens;
  }
97272
public function ifMatches(string $regex)
    {
        if ($this->value->isMatchedBy($regex)) {
            return $this->value->value();
        }

        $this->paramErrors->append($this->paramName, 'FIELD_WRONG_VALUE');
        return null;
    }
91568
public function responseMatches($regex)
    {
        $actual = $this->session->getPage()->getContent();
        $message = sprintf('The pattern %s was not found anywhere in the HTML response of the page.', $regex);

        $this->assert((bool) preg_match($regex, $actual), $message);
    }
1131118
static function input_attr(&$attr)
	{
	    $str = " ";
        if(!empty($attr) && is_array($attr))
        {
            foreach($attr as $key=>$value)
            {
                $str .= "$key=\"$value\" ";
            }
        }
        return $str;
	}
170774
protected function attr($src = null, array $attr = array())
    {
        if (null !== $src) {
            $attr['src'] = $src;
        }
        $attr['type'] = 'text/javascript';
        return $this->escaper->attr($attr);
    }
1331778
protected function peek($regex, &$out, $from = null)
    {
        if (! isset($from)) {
            $from = $this->count;
        }

        $r = '/' . $regex . '/' . $this->patternModifiers;
        $result = preg_match($r, $this->buffer, $out, null, $from);

        return $result;
    }
203568
private function escapeAttributes($attrs)
    {
        $script = '[';
        $first = true;
        foreach ($attrs as $name => $value) {
            if ($first) {
                $first = false;
            } else {
                $script .= ' ';
            }
            $script .= $name . '=' . self::escape($value);
        }
        $script .= ']';

        return $script;
    }
414865
public static function filter($attrValue, array $map)
	{
		foreach ($map as $pair)
		{
			if (preg_match($pair[0], $attrValue))
			{
				return $pair[1];
			}
		}

		return $attrValue;
	}
97862
protected function getAttributeNamesFromRegexps(array $regexps)
	{
		$attrNames = [];
		foreach ($regexps as list($regexp, $map))
		{
			$attrNames += array_flip(array_filter($map));
		}

		return $attrNames;
	}
1228239
public function regexp($field, $regex, array $attributes = [])
    {
        $query = new RegexpQuery($field, $regex, $attributes);

        $this->append($query);

        return $this;
    }
316720
private function parse_attributes($attr)
    {
        $html = '';

        if (!empty($attr)) {
            $html = '';

            foreach ($attr as $key => $value) {
                $html .= \sprintf('%s="%s" ', $key, \esc_attr($value));
            }
        }

        return \trim($html);
    }
502374
public function script($src, $attr = array())
    {
        $src = $this->Assets->getScript($src);
        $attr['src'] = $src;
        return $this->tag('script', $attr, '', true);
    }