summaryrefslogtreecommitdiff
path: root/test/HTML5/Parser/EventStack.php
diff options
context:
space:
mode:
authorTechnosophos <[email protected]>2013-04-19 17:43:28 -0500
committerTechnosophos <[email protected]>2013-04-19 17:43:28 -0500
commit9351d1c046ed3a6a82db3daa7eaab2336d5b204d (patch)
tree494bde4b282a86132e8817751dd21ea96dc8e4fa /test/HTML5/Parser/EventStack.php
parent4e5458898e6d9a73d3eae7b3213187407a940ce8 (diff)
Full support for rawtext. Unit tests finished.
Diffstat (limited to 'test/HTML5/Parser/EventStack.php')
-rw-r--r--test/HTML5/Parser/EventStack.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/HTML5/Parser/EventStack.php b/test/HTML5/Parser/EventStack.php
index f197855..c9ac20e 100644
--- a/test/HTML5/Parser/EventStack.php
+++ b/test/HTML5/Parser/EventStack.php
@@ -4,6 +4,12 @@ namespace HTML5\Parser;
/**
* This testing class gathers events from a parser and builds a stack of events.
* It is useful for checking the output of a tokenizer.
+ *
+ * IMPORTANT:
+ *
+ * The startTag event also kicks the parser into TEXTMODE_RAW when it encounters
+ * script or pre tags. This is to match the behavior required by the HTML5 spec,
+ * which says that the tree builder must tell the tokenizer when to switch states.
*/
class EventStack implements EventHandler {
protected $stack;
@@ -42,6 +48,9 @@ class EventStack implements EventHandler {
public function startTag($name, $attributes = array(), $selfClosing = FALSE) {
$args = func_get_args();
$this->store('startTag', $args);
+ if ($name == 'pre' || $name == 'script') {
+ return Tokenizer::TEXTMODE_RAW;
+ }
}
public function endTag($name) {