You are here

protected function Tokenizer::characterData 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::characterData()

Parse anything that looks like character data.

Different rules apply based on the current text mode.

See also

Elements::TEXT_RAW Elements::TEXT_RCDATA.

2 calls to Tokenizer::characterData()
Tokenizer::consumeData in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume a character and make a move. HTML5 8.2.4.1
Tokenizer::tagOpen in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Emit a tagStart event on encountering a tag.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function characterData() {
  if ($this->scanner
    ->current() === false) {
    return false;
  }
  switch ($this->textMode) {
    case Elements::TEXT_RAW:
      return $this
        ->rawText();
    case Elements::TEXT_RCDATA:
      return $this
        ->rcdata();
    default:
      $tok = $this->scanner
        ->current();
      if (strspn($tok, "<&")) {
        return false;
      }
      return $this
        ->text();
  }
}