You are here

public function Tokenizer::setTextMode 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::setTextMode()

Set the text mode for the character data reader.

HTML5 defines three different modes for reading text:

  • Normal: Read until a tag is encountered.
  • RCDATA: Read until a tag is encountered, but skip a few otherwise-

special characters.

  • Raw: Read until a special closing tag is encountered (viz. pre, script)

This allows those modes to be set.

Normally, setting is done by the event handler via a special return code on startTag(), but it can also be set manually using this function.

Parameters

integer $textmode: One of Elements::TEXT_*

string $untilTag: The tag that should stop RAW or RCDATA mode. Normal mode does not use this indicator.

3 calls to Tokenizer::setTextMode()
Tokenizer::rawText in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read text in RAW mode.
Tokenizer::rcdata in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read text in RCDATA mode.
Tokenizer::tagName in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume a tag name and body. 8.2.4.10

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

public function setTextMode($textmode, $untilTag = null) {
  $this->textMode = $textmode & (Elements::TEXT_RAW | Elements::TEXT_RCDATA);
  $this->untilTag = $untilTag;
}