summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2014-02-07 23:07:32 -0500
committerMatt Farina <[email protected]>2014-02-07 23:07:32 -0500
commitd4b0222f622f3deb67d1c7366edc7f0a0aae9523 (patch)
treee58f17c8494a9a33d23b64bfdbd68c1765608eee /src
parent8785fc5775df52dd4a6b63677ebd08f8301ffdcc (diff)
#26: Updated the case handling for tags to allow for uppercase tags and normalizing tag names to lowercase (per 8.2.4.9) except for SVG foreign tags that are case sensitive.
Diffstat (limited to 'src')
-rw-r--r--src/HTML5/Parser/DOMTreeBuilder.php9
-rw-r--r--src/HTML5/Parser/Tokenizer.php4
2 files changed, 9 insertions, 4 deletions
diff --git a/src/HTML5/Parser/DOMTreeBuilder.php b/src/HTML5/Parser/DOMTreeBuilder.php
index 6dbd25e..13ae3bc 100644
--- a/src/HTML5/Parser/DOMTreeBuilder.php
+++ b/src/HTML5/Parser/DOMTreeBuilder.php
@@ -289,6 +289,11 @@ class DOMTreeBuilder implements EventHandler {
return;
}
+ // Special case handling for SVG.
+ if ($this->insertMode == static::IM_IN_SVG) {
+ $lname = Elements::normalizeSvgElement($lname);
+ }
+
// XXX: Not sure whether we need this anymore.
// if ($name != $lname) {
// return $this->quirksTreeResolver($lname);
@@ -301,8 +306,8 @@ class DOMTreeBuilder implements EventHandler {
}
//$this->current = $this->current->parentNode;
- if (!$this->autoclose($name)) {
- $this->parseError('Could not find closing tag for ' . $name);
+ if (!$this->autoclose($lname)) {
+ $this->parseError('Could not find closing tag for ' . $lname);
}
//switch ($this->insertMode) {
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index f81f069..04baa10 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -295,7 +295,7 @@ class Tokenizer {
return $this->bogusComment('</');
}
- $name = $this->scanner->charsUntil("\n\f \t>");
+ $name = strtolower($this->scanner->charsUntil("\n\f \t>"));
// Trash whitespace.
$this->scanner->whitespace();
@@ -831,7 +831,7 @@ class Tokenizer {
$buffer .= $this->scanner->charsUntil($first);
// Stop as soon as we hit the stopping condition.
- if ($this->sequenceMatches($sequence)) {
+ if ($this->sequenceMatches($sequence) || $this->sequenceMatches(strtoupper($sequence))) {
return $buffer;
}
$buffer .= $this->scanner->current();