summaryrefslogtreecommitdiff
path: root/src/HTML5
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTML5')
-rw-r--r--src/HTML5/Parser/Tokenizer.php30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index 7b0b3f3..4aeeb50 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -121,11 +121,16 @@ class Tokenizer
*/
protected function consumeData()
{
- // Character reference
- $this->characterReference();
-
$tok = $this->scanner->current();
+ if ($tok === '&') {
+ // Character reference
+ $ref = $this->decodeCharacterReference();
+ $this->buffer($ref);
+
+ $tok = $this->scanner->current();
+ }
+
// Parse tag
if ($tok === '<') {
// Any buffered text data can go out now.
@@ -304,25 +309,6 @@ class Tokenizer
}
/**
- * Handle character references (aka entities).
- *
- * This version is specific to PCDATA, as it buffers data into the
- * text buffer. For a generic version, see decodeCharacterReference().
- *
- * HTML5 8.2.4.2
- */
- protected function characterReference()
- {
- if ($this->scanner->current() !== '&') {
- return false;
- }
-
- $ref = $this->decodeCharacterReference();
- $this->buffer($ref);
- return true;
- }
-
- /**
* Look for markup.
*/
protected function markupDeclaration($tok)