summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-15 11:24:22 -0400
committerMatt Farina <[email protected]>2013-05-15 11:24:22 -0400
commit0cdf4ae1aaf6aefdc7218dbb49e543e8603035a8 (patch)
treec10b651f07469b06242ac5ac8863250a957e9fd9 /src/HTML5/Parser
parent5be96c81985e8a40cfcaeff9c5d7ee055b46ac08 (diff)
parent69d1932bac21ded3d10f5df1a94d892efa2c1b89 (diff)
Merge branch 'master' of github.com:technosophos/HTML5-PHP
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r--src/HTML5/Parser/TreeBuildingRules.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/HTML5/Parser/TreeBuildingRules.php b/src/HTML5/Parser/TreeBuildingRules.php
index 111da1e..f9aaa1e 100644
--- a/src/HTML5/Parser/TreeBuildingRules.php
+++ b/src/HTML5/Parser/TreeBuildingRules.php
@@ -10,6 +10,10 @@ use HTML5\Elements;
* individual basis. This class handles those rules.
*
* See section 8.1.2.4 of the spec.
+ *
+ * @todo
+ * - colgroup and col special behaviors
+ * - body and head special behaviors
*/
class TreeBuildingRules {
@@ -19,6 +23,15 @@ class TreeBuildingRules {
'dt' => 1,
'rt' => 1,
'rp' => 1,
+ 'tr' => 1,
+ 'th' => 1,
+ 'td' => 1,
+ 'thead' => 1,
+ 'tfoot' => 1,
+ 'tbody' => 1,
+ 'table' => 1,
+ 'optgroup' => 1,
+ 'option' => 1,
);
/**
@@ -57,6 +70,20 @@ class TreeBuildingRules {
case 'rt':
case 'rp':
return $this->handleRT($new, $current);
+ case 'optgroup':
+ $this->closeIfCurrentMatches($new, $current, array('optgroup'));
+ case 'option':
+ $this->closeIfCurrentMatches($new, $current, array('option', 'optgroup'));
+ case 'tr':
+ $this->closeIfCurrentMatches($new, $current, array('tr'));
+ case 'td':
+ case 'th':
+ $this->closeIfCurrentMatches($new, $current, array('th', 'td'));
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ case 'table': // Spec isn't explicit about this, but it's necessary.
+ $this->closeIfCurrentMatches($new, $current, array('thead', 'tfoot', 'tbody'));
}