0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-05 14:11:52 +00:00

[1.7.0] Modify behavior of ElementDef->mergeIn to also merge safe property, this means default is now null.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1048 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-05-12 21:47:03 +00:00
parent cb9c96a2b0
commit bda9167423
2 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,7 @@ class HTMLPurifier_ElementDef
/** /**
* Is this element safe for untrusted users to use? * Is this element safe for untrusted users to use?
*/ */
var $safe = false; var $safe;
/** /**
* Low-level factory constructor for creating new standalone element defs * Low-level factory constructor for creating new standalone element defs
@ -137,6 +137,7 @@ class HTMLPurifier_ElementDef
if(!empty($def->content_model)) $this->content_model .= ' | ' . $def->content_model; if(!empty($def->content_model)) $this->content_model .= ' | ' . $def->content_model;
if(!empty($def->content_model_type)) $this->content_model_type = $def->content_model_type; if(!empty($def->content_model_type)) $this->content_model_type = $def->content_model_type;
if(!is_null($def->descendants_are_inline)) $this->descendants_are_inline = $def->descendants_are_inline; if(!is_null($def->descendants_are_inline)) $this->descendants_are_inline = $def->descendants_are_inline;
if(!is_null($def->safe)) $this->safe = $def->safe;
} }

View File

@ -42,6 +42,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase
'old' => true, 'old' => true,
'removed-old' => true 'removed-old' => true
); );
$def1->safe = false;
$def2->standalone = false; $def2->standalone = false;
$def2->attr = array( $def2->attr = array(
@ -68,6 +69,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase
'new' => true, 'new' => true,
'removed-old' => false 'removed-old' => false
); );
$def2->safe = true;
$def1->mergeIn($def2); $def1->mergeIn($def2);
$def1->mergeIn($def3); // empty, has no effect $def1->mergeIn($def3); // empty, has no effect
@ -97,6 +99,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase
'old' => true, 'old' => true,
'new' => true 'new' => true
)); ));
$this->assertIdentical($def1->safe, true);
} }