| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wikimedia\RemexHtml\TreeBuilder; |
| 4 |
|
| 5 |
use Wikimedia\RemexHtml\Tokenizer\Attributes; |
| 6 |
|
| 7 |
/** |
| 8 |
* The "after frameset" insertion mode |
| 9 |
*/ |
| 10 |
class AfterFrameset extends InsertionMode { |
| 11 |
/** @inheritDoc */ |
| 12 |
public function characters( $text, $start, $length, $sourceStart, $sourceLength ) { |
| 13 |
$this->handleFramesetWhitespace( false, $text, $start, $length, $sourceStart, $sourceLength ); |
| 14 |
} |
| 15 |
|
| 16 |
/** @inheritDoc */ |
| 17 |
public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) { |
| 18 |
$builder = $this->builder; |
| 19 |
$dispatcher = $this->dispatcher; |
| 20 |
|
| 21 |
switch ( $name ) { |
| 22 |
case 'html': |
| 23 |
$dispatcher->inBody->startTag( |
| 24 |
$name, $attrs, $selfClose, $sourceStart, $sourceLength ); |
| 25 |
break; |
| 26 |
|
| 27 |
case 'noframes': |
| 28 |
$dispatcher->inHead->startTag( |
| 29 |
$name, $attrs, $selfClose, $sourceStart, $sourceLength ); |
| 30 |
break; |
| 31 |
|
| 32 |
default: |
| 33 |
$builder->error( "unexpected start tag after frameset, ignoring", $sourceStart ); |
| 34 |
return; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
/** @inheritDoc */ |
| 39 |
public function endTag( $name, $sourceStart, $sourceLength ) { |
| 40 |
$builder = $this->builder; |
| 41 |
$dispatcher = $this->dispatcher; |
| 42 |
|
| 43 |
switch ( $name ) { |
| 44 |
case 'html': |
| 45 |
$dispatcher->switchMode( Dispatcher::AFTER_AFTER_FRAMESET ); |
| 46 |
break; |
| 47 |
|
| 48 |
default: |
| 49 |
$builder->error( "unexpected end tag after frameset, ignoring", $sourceStart ); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
/** @inheritDoc */ |
| 54 |
public function endDocument( $pos ) { |
| 55 |
$this->builder->stopParsing( $pos ); |
| 56 |
} |
| 57 |
} |