summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Butcher <[email protected]>2013-05-15 09:32:46 -0500
committerMatt Butcher <[email protected]>2013-05-15 09:32:46 -0500
commitd2a31c74e529aa84e70a38c8da3ce6d551dd6583 (patch)
treee958ded44a3ad9ebebff1a3760ac15c41af33158 /src
parent823fe770fd1a5f97c2a92e0cdfacecb30521f73f (diff)
Updaed TreeBuildingRules for tables and other elements.
Diffstat (limited to 'src')
-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'));
}