summaryrefslogtreecommitdiff
path: root/test/HTML5/Parser/TokenizerTest.php
diff options
context:
space:
mode:
authorAsmir Mustafic <[email protected]>2017-08-28 14:44:01 +0200
committerAsmir Mustafic <[email protected]>2017-08-28 14:44:01 +0200
commit2a38f56f3772f943be436c7b411c2ae5fac6cee6 (patch)
tree2b1cec9a30b2301afeda759a16341972b5a492bd /test/HTML5/Parser/TokenizerTest.php
parente965886a79a560b4b00a4c471e2bdfafea23fdcb (diff)
Fixes https://github.com/Masterminds/html5-php/issues/124
Reference: https://www.w3.org/TR/html52/syntax.html#character-reference-state If the character reference was consumed as part of an attribute (return state is either attribute value (double-quoted) state, attribute value (single-quoted) state or attribute value (unquoted) state), and the last character matched is not a U+003B SEMICOLON character (;), and the next input character is either a U+003D EQUALS SIGN character (=) or an alphanumeric ASCII character, then, for historical reasons, switch to the character reference end state. If the last character matched is not a U+003B SEMICOLON character (;), this is a parse error.
Diffstat (limited to 'test/HTML5/Parser/TokenizerTest.php')
-rw-r--r--test/HTML5/Parser/TokenizerTest.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php
index f2f612c..5e52722 100644
--- a/test/HTML5/Parser/TokenizerTest.php
+++ b/test/HTML5/Parser/TokenizerTest.php
@@ -622,6 +622,13 @@ class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase
),
false
),
+ "<foo a='blue&red'>" => array(
+ 'foo',
+ array(
+ 'a' => 'blue&red'
+ ),
+ false
+ ),
"<foo a='blue&amp;red'>" => array(
'foo',
array(
@@ -629,6 +636,13 @@ class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase
),
false
),
+ "<foo a='blue&&amp;&red'>" => array(
+ 'foo',
+ array(
+ 'a' => 'blue&&&red'
+ ),
+ false
+ ),
"<foo a='blue&&amp;red'>" => array(
'foo',
array(
@@ -725,18 +739,11 @@ class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase
// Cause a parse error.
$bad = array(
- // This will emit an entity lookup failure for &red.
- "<foo a='blue&red'>" => array(
+ // This will emit an entity lookup failure for &+dark.
+ "<foo a='blue&+dark'>" => array(
'foo',
array(
- 'a' => 'blue&red'
- ),
- false
- ),
- "<foo a='blue&&amp;&red'>" => array(
- 'foo',
- array(
- 'a' => 'blue&&&red'
+ 'a' => 'blue&+dark'
),
false
),