diff options
Diffstat (limited to 'src/HTML5/Parser/Scanner.php')
-rw-r--r-- | src/HTML5/Parser/Scanner.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php index e81b3a9..cec9a13 100644 --- a/src/HTML5/Parser/Scanner.php +++ b/src/HTML5/Parser/Scanner.php @@ -223,10 +223,20 @@ class Scanner * Consume whitespace. * * Whitespace in HTML5 is: formfeed, tab, newline, space. + * + * @return int The length of the matched whitespaces */ public function whitespace() { - return $this->doCharsWhile("\n\t\f "); + if ($this->char >= $this->EOF) { + return false; + } + + $len = strspn($this->data, "\n\t\f ", $this->char); + + $this->char += $len; + + return $len; } /** |