mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-04 21:28:06 +02:00
feat: add directive for removing blank nodes (#404)
This commit is contained in:
10
tests/HTMLPurifier/FixtureData/RemoveBlankTestCaseInput.html
Normal file
10
tests/HTMLPurifier/FixtureData/RemoveBlankTestCaseInput.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<table>
|
||||
<caption>
|
||||
Cool Table
|
||||
</caption>
|
||||
<tr>
|
||||
<td>
|
||||
Element 1
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@@ -0,0 +1,7 @@
|
||||
<table><caption>
|
||||
Cool Table
|
||||
</caption>
|
||||
<tr><td>
|
||||
Element 1
|
||||
</td>
|
||||
</tr></table>
|
@@ -399,6 +399,19 @@ a[href|title]
|
||||
$this->assertIdentical($input, $output);
|
||||
}
|
||||
|
||||
public function test_removeBlanks()
|
||||
{
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Core.RemoveBlanks', true);
|
||||
|
||||
$input = file_get_contents(__DIR__ . '/FixtureData/RemoveBlankTestCaseInput.html');
|
||||
$expected = file_get_contents(__DIR__ . '/FixtureData/RemoveBlankTestCaseOutput.html');
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$actual = $purifier->purify($input);
|
||||
$this->assertIdentical($expected, $actual);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
Reference in New Issue
Block a user