Skip to content

Commit

Permalink
Merge 98e80dd into 700717e
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Feb 2, 2015
2 parents 700717e + 98e80dd commit 5a28f10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/HTML5/Parser/Tokenizer.php
Expand Up @@ -200,7 +200,7 @@ protected function rcdata()
if (is_null($this->untilTag)) {
return $this->text();
}
$sequence = '</' . $this->untilTag . '>';
$sequence = '</' . $this->untilTag;
$txt = '';
$tok = $this->scanner->current();

Expand All @@ -214,6 +214,10 @@ protected function rcdata()
$tok = $this->scanner->next();
}
}
$this->scanner->whitespace();
if ($tok !== '>') {
$this->parseError("Unclosed RCDATA end tag");
}
$this->events->text($txt);
$this->setTextMode(0);
return $this->endTag();
Expand Down
6 changes: 6 additions & 0 deletions test/HTML5/Parser/TokenizerTest.php
Expand Up @@ -884,6 +884,12 @@ public function testRawText()
$this->assertEventEquals('startTag', 'title', $events->get(0));
$this->assertEventEquals('text', 'a test', $events->get(1));
$this->assertEventEquals('endTag', 'title', $events->get(2));

// Testing end tags with whitespaces
$events = $this->parse('<title>Whitespaces are tasty</title >');
$this->assertEventEquals('startTag', 'title', $events->get(0));
$this->assertEventEquals('text', 'Whitespaces are tasty', $events->get(1));
$this->assertEventEquals('endTag', 'title', $events->get(2));
}

public function testRcdata()
Expand Down

0 comments on commit 5a28f10

Please sign in to comment.