You are here

protected function simple_html_dom::parse_attr in simplehtmldom API 7

Same name and namespace in other branches
  1. 5.2 simplehtmldom/simple_html_dom.php \simple_html_dom::parse_attr()
  2. 6 simplehtmldom/simple_html_dom.php \simple_html_dom::parse_attr()
1 call to simple_html_dom::parse_attr()
simple_html_dom::read_tag in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 823

Class

simple_html_dom

Code

protected function parse_attr($node, $name, &$space) {
  $space[2] = $this
    ->copy_skip($this->token_blank);
  switch ($this->char) {
    case '"':
      $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
      $this->char = ++$this->pos < $this->size ? $this->doc[$this->pos] : null;

      // next
      $node->attr[$name] = $this
        ->restore_noise($this
        ->copy_until_char_escape('"'));
      $this->char = ++$this->pos < $this->size ? $this->doc[$this->pos] : null;

      // next
      break;
    case '\'':
      $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
      $this->char = ++$this->pos < $this->size ? $this->doc[$this->pos] : null;

      // next
      $node->attr[$name] = $this
        ->restore_noise($this
        ->copy_until_char_escape('\''));
      $this->char = ++$this->pos < $this->size ? $this->doc[$this->pos] : null;

      // next
      break;
    default:
      $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
      $node->attr[$name] = $this
        ->restore_noise($this
        ->copy_until($this->token_attr));
  }
}