1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 05:37:49 +02:00

Change unacceptable value default behavior to drop silently.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@269 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-15 23:58:18 +00:00
parent 38e0485fcd
commit 0da17072d1
8 changed files with 36 additions and 19 deletions

View File

@@ -24,14 +24,13 @@ class HTMLPurifier_Strategy_CoreTest
$expect[1] = '<b>Make well formed.</b>';
$inputs[2] = '<b><div>Fix nesting.</div></b>';
$expect[2] = '<b></b>';
$expect[2] = '<b>Fix nesting.</b>';
// behavior may change
$inputs[3] = '<asdf>Foreign element removal.</asdf>';
$expect[3] = '&lt;asdf&gt;Foreign element removal.&lt;/asdf&gt;';
$expect[3] = 'Foreign element removal.';
$inputs[4] = '<foo><b><div>All three.</div></b>';
$expect[4] = '&lt;foo&gt;<b></b>';
$expect[4] = '<b>All three.</b>';
$this->assertStrategyWorks($strategy, $inputs, $expect, $config);
}

View File

@@ -29,9 +29,9 @@ class HTMLPurifier_Strategy_FixNestingTest
$inputs[1] = '<a href="about:blank">Blank</a><div>Block</div>';
$expect[1] = $inputs[1];
// illegal block in inline, element -> text
// illegal block in inline
$inputs[2] = '<b><div>Illegal div.</div></b>';
$expect[2] = '<b></b>';
$expect[2] = '<b>Illegal div.</b>';
// same test with different configuration (fragile)
$inputs[13] = '<b><div>Illegal div.</div></b>';
@@ -72,7 +72,7 @@ class HTMLPurifier_Strategy_FixNestingTest
// block in inline ins not allowed
$inputs[11] = '<span><ins><div>Not allowed!</div></ins></span>';
$expect[11] = '<span><ins></ins></span>';
$expect[11] = '<span><ins>Not allowed!</ins></span>';
// block in inline ins not allowed
$inputs[14] = '<span><ins><div>Not allowed!</div></ins></span>';

View File

@@ -28,7 +28,7 @@ class HTMLPurifier_Strategy_MakeWellFormedTest
// CHANGE THIS BEHAVIOR!
$inputs[4] = 'Unused end tags... recycle!</b>';
$expect[4] = 'Unused end tags... recycle!&lt;/b&gt;';
$expect[4] = 'Unused end tags... recycle!';
$inputs[5] = '<br style="clear:both;">';
$expect[5] = '<br style="clear:both;" />';

View File

@@ -22,7 +22,7 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest
// [INVALID]
$inputs[2] = '<asdf>Bling</asdf><d href="bang">Bong</d><foobar />';
$expect[2] = htmlspecialchars($inputs[2]);
$expect[2] = 'BlingBong';
// test simple transform
$inputs[3] = '<menu><li>Item 1</li></menu>';