You are here

protected function Tokenizer::unquotedAttributeValue 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::unquotedAttributeValue()
1 call to Tokenizer::unquotedAttributeValue()
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 550

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function unquotedAttributeValue() {
  $stoplist = "\t\n\f >";
  $val = '';
  $tok = $this->scanner
    ->current();
  while (strspn($tok, $stoplist) == 0 && $tok !== false) {
    if ($tok == '&') {
      $val .= $this
        ->decodeCharacterReference(true);
      $tok = $this->scanner
        ->current();
    }
    else {
      if (strspn($tok, "\"'<=`") > 0) {
        $this
          ->parseError("Unexpected chars in unquoted attribute value %s", $tok);
      }
      $val .= $tok;
      $tok = $this->scanner
        ->next();
    }
  }
  return $val;
}