3 namespace RemexHtml\TreeBuilder;
4 use RemexHtml\Tokenizer\Attributes;
7 * The "text" insertion mode
9 class Text extends InsertionMode {
10 public function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
11 $this->builder->insertCharacters( $text, $start, $length, $sourceStart, $sourceLength );
14 public function endDocument( $pos ) {
15 $this->builder->error( 'unexpected end of input in text mode', $pos );
16 $this->builder->pop( $pos, 0 );
17 $this->dispatcher->restoreMode()
18 ->endDocument( $pos );
21 public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
22 throw new TreeBuilderError( 'unexpected token' );
25 public function endTag( $name, $sourceStart, $sourceLength ) {
26 // I think this is complete if we have no support for executing scripts
27 $this->builder->pop( $sourceStart, $sourceLength );
28 $this->dispatcher->restoreMode();