You are here

public function EventStack::startTag in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/masterminds/html5/test/HTML5/Parser/EventStack.php \Masterminds\HTML5\Tests\Parser\EventStack::startTag()

A start tag.

IMPORTANT: The parser watches the return value of this event. If this returns an integer, the parser will switch TEXTMODE patters according to the int.

This is how the Tree Builder can tell the Tokenizer when a certain tag should cause the parser to go into RAW text mode.

The HTML5 standard requires that the builder is the one that initiates this step, and this is the only way short of a circular reference that we can do that.

Example: if a startTag even for a `script` name is fired, and the startTag() implementation returns Tokenizer::TEXTMODE_RAW, then the tokenizer will switch into RAW text mode and consume data until it reaches a closing `script` tag.

The textmode is automatically reset to Tokenizer::TEXTMODE_NORMAL when the closing tag is encounter. **This behavior may change.**

Parameters

string $name: The tag name.

array $attributes: An array with all of the tag's attributes.

boolean $selfClosing: An indicator of whether or not this tag is self-closing (<foo/>)

Return value

numeric One of the Tokenizer::TEXTMODE_* constants.

Overrides EventHandler::startTag

File

vendor/masterminds/html5/test/HTML5/Parser/EventStack.php, line 64

Class

EventStack
This testing class gathers events from a parser and builds a stack of events. It is useful for checking the output of a tokenizer.

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function startTag($name, $attributes = array(), $selfClosing = false) {
  $args = func_get_args();
  $this
    ->store('startTag', $args);
  if ($name == 'pre' || $name == 'script') {
    return Elements::TEXT_RAW;
  }
}