0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

Fixed Issue #264: <thead> element removed from <table> if there are no <tbody> or <tr> elements (#283)

This commit is contained in:
Marcus Artner 2021-01-26 17:11:50 +01:00 committed by GitHub
parent 2512f595e0
commit 214cb8a693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
}
}
if (empty($content)) {
if (empty($content) && $thead === false && $tfoot === false) {
return false;
}

View File

@ -44,6 +44,22 @@ class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
);
}
public function testTheadOnlyNotRemoved()
{
$this->assertResult(
'<thead><tr><th>a</th></tr></thead>',
'<thead><tr><th>a</th></tr></thead>'
);
}
public function testTbodyOnlyNotRemoved()
{
$this->assertResult(
'<tbody><tr><th>a</th></tr></tbody>',
'<tbody><tr><th>a</th></tr></tbody>'
);
}
public function testTrOverflowAndClose()
{
$this->assertResult(