Fixed table head being removed
authorAlexander Ebert <ebert@woltlab.com>
Wed, 12 Oct 2016 08:15:39 +0000 (10:15 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 12 Oct 2016 08:15:39 +0000 (10:15 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTable.class.php

index d63617aa90c2435e6c049ac4e5131bc3f01daa22..1587505c1641029b435a27edef97936c40c8eede 100644 (file)
@@ -41,7 +41,12 @@ class HtmlInputNodeTable extends AbstractHtmlInputNode {
                        
                        // check if each `<tr>` has at least one `<td>`
                        foreach ($trs as $tr) {
-                               if ($tr->getElementsByTagName('td')->length === 0) {
+                               $childTagName = 'td';
+                               if ($tr->parentNode->nodeName === 'thead') {
+                                       $childTagName = 'th';
+                               }
+                               
+                               if ($tr->getElementsByTagName($childTagName)->length === 0) {
                                        DOMUtil::removeNode($tr);
                                }
                        }