From d2a31c74e529aa84e70a38c8da3ce6d551dd6583 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Wed, 15 May 2013 09:32:46 -0500 Subject: Updaed TreeBuildingRules for tables and other elements. --- src/HTML5/Parser/TreeBuildingRules.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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')); } -- cgit v1.2.3