diff --git a/NEWS b/NEWS index 645ce91f..bfe6a285 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Deprecated and removed EnableRedundantUTF8Cleaning. It didn't even work! - DOMLex will not emit errors when a custom error handler that does not honor error_reporting is used +- StrictBlockquote child definition refrains from wrapping whitespace + in tags now. . Unit test for ElementDef created, ElementDef behavior modified to be more flexible . Added convenience functions for HTMLModule constructors diff --git a/library/HTMLPurifier/ChildDef/StrictBlockquote.php b/library/HTMLPurifier/ChildDef/StrictBlockquote.php index 9280a9f5..c4c78810 100644 --- a/library/HTMLPurifier/ChildDef/StrictBlockquote.php +++ b/library/HTMLPurifier/ChildDef/StrictBlockquote.php @@ -45,8 +45,8 @@ extends HTMLPurifier_ChildDef_Required if (!$is_inline) { if (!$depth) { if ( - $token->type == 'text' || - !isset($this->elements[$token->name]) + ($token->type == 'text' && !$token->is_whitespace) || + ($token->type != 'text' && !isset($this->elements[$token->name])) ) { $is_inline = true; $ret[] = $block_wrap_start; diff --git a/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php b/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php index 56405e91..76113bcd 100644 --- a/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php +++ b/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php @@ -11,10 +11,13 @@ extends HTMLPurifier_ChildDefHarness $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p'); + // assuming default wrap is p + $this->assertResult(''); $this->assertResult('
Valid
'); $this->assertResult('Needs wrap
'); + $this->assertResult('Do not wrap
Whitespace
'); $this->assertResult( 'Wrap'. 'Do not wrap
', 'Wrap
Do not wrap
' @@ -35,6 +38,7 @@ extends HTMLPurifier_ChildDefHarness 'Fools!
', 'Bar'. 'PeopleConniving.
Fools!
' ); + $this->assertResult('Needs wrap', '