36 public $elements = array(
'tr' =>
true,
'tbody' =>
true,
'thead' =>
true,
37 'tfoot' =>
true,
'caption' =>
true,
'colgroup' =>
true,
'col' =>
true);
40 if (empty($tokens_of_children))
return false;
45 $tokens_of_children[] =
false;
57 $is_collecting =
false;
59 $collection = array();
65 foreach ($tokens_of_children as
$token) {
66 $is_child = ($nesting == 0);
68 if ($token ===
false) {
81 switch ($collection[$tag_index]->name) {
88 if ($caption !==
false)
break;
89 $caption = $collection;
102 $var = $collection[$tag_index]->name;
103 if ($
$var ===
false) {
115 $collection[$tag_index]->name =
'tbody';
116 $collection[count($collection)-1]->name =
'tbody';
121 $cols[] = $collection;
124 $collection = array();
125 $is_collecting =
false;
134 if ($token ===
false)
break;
138 if ($token->name ==
'col') {
141 $cols[] = array_merge($collection, array($token));
142 $collection = array();
146 switch($token->name) {
153 $is_collecting =
true;
157 if (!empty($token->is_whitespace)) {
169 if ($caption !==
false)
$ret = array_merge(
$ret, $caption);
170 if ($cols !==
false)
foreach ($cols as $token_array)
$ret = array_merge(
$ret, $token_array);
171 if ($thead !==
false)
$ret = array_merge(
$ret, $thead);
172 if ($tfoot !==
false)
$ret = array_merge(
$ret, $tfoot);
177 $inside_tbody =
false;
178 foreach (
$content as $token_array) {
180 foreach ($token_array as $t) {
181 if ($t->name ===
'tr' || $t->name ===
'tbody') {
185 if ($t->name ===
'tr') {
187 $ret = array_merge(
$ret, $token_array);
190 $ret = array_merge(
$ret, $token_array);
191 $inside_tbody =
true;
193 } elseif ($t->name ===
'tbody') {
196 $inside_tbody =
false;
197 $ret = array_merge(
$ret, $token_array);
199 $ret = array_merge(
$ret, $token_array);
202 trigger_error(
"tr/tbody in content invariant failed in Table ChildDef", E_USER_ERROR);
209 foreach (
$content as $token_array) {
211 $ret = array_merge(
$ret, $token_array);
215 if (!empty($collection) && $is_collecting ==
false){
217 $ret = array_merge(
$ret, $collection);
220 array_pop($tokens_of_children);
222 return (
$ret === $tokens_of_children) ?
true :
$ret;