You are here

protected function Tokenizer::quotedAttributeValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php \Masterminds\HTML5\Parser\Tokenizer::quotedAttributeValue()

Get an attribute value string.

Parameters

string $quote: IMPORTANT: This is a series of chars! Any one of which will be considered termination of an attribute's value. E.g. "\"'" will stop at either ' or ".

Return value

string The attribute value.

1 call to Tokenizer::quotedAttributeValue()
Tokenizer::attributeValue in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume an attribute value. 8.2.4.37 and after.

File

vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php, line 532

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function quotedAttributeValue($quote) {
  $stoplist = "\f" . $quote;
  $val = '';
  $tok = $this->scanner
    ->current();
  while (strspn($tok, $stoplist) == 0 && $tok !== false) {
    if ($tok == '&') {
      $val .= $this
        ->decodeCharacterReference(true);
      $tok = $this->scanner
        ->current();
    }
    else {
      $val .= $tok;
      $tok = $this->scanner
        ->next();
    }
  }
  $this->scanner
    ->next();
  return $val;
}