summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorAsmir Mustafic <[email protected]>2014-11-24 17:15:44 +0100
committerAsmir Mustafic <[email protected]>2014-11-24 17:15:44 +0100
commitca8ed88fa5ad706c6b38413315d6f556034e6a22 (patch)
tree7865f50ccab69be5947130776014446cb4e1d035 /src/HTML5/Parser
parentf50e87904ed0857ea2dead2ae4facf7d95c743fd (diff)
Case insensitive tags
fixes #63
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r--src/HTML5/Parser/Tokenizer.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index 92510de..b587a1f 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -203,7 +203,7 @@ class Tokenizer
$sequence = '</' . $this->untilTag . '>';
$txt = '';
$tok = $this->scanner->current();
- while ($tok !== false && ! ($tok == '<' && ($this->sequenceMatches($sequence) || $this->sequenceMatches(strtoupper($sequence))))) {
+ while ($tok !== false && ! ($tok == '<' && ($this->sequenceMatches($sequence, false)))) {
if ($tok == '&') {
$txt .= $this->decodeCharacterReference();
$tok = $this->scanner->current();
@@ -891,7 +891,7 @@ class Tokenizer
$buffer .= $this->scanner->charsUntil($first);
// Stop as soon as we hit the stopping condition.
- if ($this->sequenceMatches($sequence) || $this->sequenceMatches(strtoupper($sequence))) {
+ if ($this->sequenceMatches($sequence, false)) {
return $buffer;
}
$buffer .= $this->scanner->current();
@@ -916,7 +916,7 @@ class Tokenizer
* see if the input stream is at the start of a
* '</script>' string.
*/
- protected function sequenceMatches($sequence)
+ protected function sequenceMatches($sequence, $caseSensitive = true)
{
$len = strlen($sequence);
$buffer = '';
@@ -932,7 +932,7 @@ class Tokenizer
}
$this->scanner->unconsume($len);
- return $buffer == $sequence;
+ return $caseSensitive ? $buffer == $sequence : strcasecmp($buffer, $sequence) === 0;
}
/**