diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index 653903c..17a3052 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -567,7 +567,7 @@ protected function attributeValue()
*/
protected function quotedAttributeValue($quote)
{
- $stoplist = "\f" . $quote;
+ $stoplist = $quote;
$val = '';
while (true) {
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php
index 0fd307e..3c267e2 100644
--- a/test/HTML5/Html5Test.php
+++ b/test/HTML5/Html5Test.php
@@ -38,6 +38,38 @@ protected function cycleFragment($fragment)
return $out;
}
+ public function testFormFeedsInQuotedAttributes()
+ {
+ foreach (array('"', "'") as $quote) {
+ $value = "\fbefore &\f after\f";
+ $html = '
';
+ $expected = "\fbefore &\f after\f";
+
+ $document = $this->html5->loadHTML($this->wrap($html));
+ $image = $document->getElementsByTagName('img')->item(0);
+ $this->assertSame($expected, $image->getAttribute('alt'));
+ $this->assertSame('foo.png', $image->getAttribute('src'));
+ $this->assertSame(2, $image->attributes->length);
+ $this->assertEmpty($this->html5->getErrors());
+
+ $fragment = $this->html5->loadHTMLFragment($html);
+ $this->assertSame($expected, $fragment->firstChild->getAttribute('alt'));
+ $serialized = $this->html5->saveHTML($fragment);
+ $reparsed = $this->html5->loadHTMLFragment($serialized);
+ $this->assertSame($expected, $reparsed->firstChild->getAttribute('alt'));
+ $this->assertSame('foo.png', $reparsed->firstChild->getAttribute('src'));
+ $this->assertEmpty($this->html5->getErrors());
+ }
+ }
+
+ public function testFormFeedStillSeparatesUnquotedAttributes()
+ {
+ $fragment = $this->html5->loadHTMLFragment("
");
+ $this->assertSame('before', $fragment->firstChild->getAttribute('alt'));
+ $this->assertSame('foo.png', $fragment->firstChild->getAttribute('src'));
+ $this->assertEmpty($this->html5->getErrors());
+ }
+
public function testImageTagsInSvg()
{
$html = '