1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Fix chameleon behavior with ins and del.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@145 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-03 01:03:23 +00:00
parent 19081ffdf2
commit aa249be067
5 changed files with 101 additions and 13 deletions

View File

@@ -105,15 +105,15 @@ class HTMLPurifier_Definition
$e_misc = "$e_misc_inline";
$e_inline = "a | $e_special | $e_fontstyle | $e_phrase".
" | $e_inline_forms";
$e__inline = "#PCDATA | $e_inline | $e_misc_inline";
// note the casing
$e_Inline = new HTMLPurifier_ChildDef_Optional("#PCDATA | $e_inline".
" | $e_misc_inline");
$e_Inline = new HTMLPurifier_ChildDef_Optional($e__inline);
$e_heading = 'h1|h2|h3|h4|h5|h6';
$e_lists = 'ul | ol | dl';
$e_blocktext = 'pre | hr | blockquote | address';
$e_block = "p | $e_heading | div | $e_lists | $e_blocktext | table";
$e_Flow = new HTMLPurifier_ChildDef_Optional("#PCDATA | $e_block".
" | $e_inline | $e_misc");
$e__flow = "#PCDATA | $e_block | $e_inline | $e_misc";
$e_Flow = new HTMLPurifier_ChildDef_Optional($e__flow);
$e_a_content = new HTMLPurifier_ChildDef_Optional("#PCDATA | $e_special".
" | $e_fontstyle | $e_phrase | $e_inline_forms | $e_misc_inline");
$e_pre_content = new HTMLPurifier_ChildDef_Optional("#PCDATA | a".
@@ -123,7 +123,8 @@ class HTMLPurifier_Definition
$e_form_button_content = new HTMLPurifier_ChildDef_Optional(''); // unused
$this->info['ins']->child =
$this->info['del']->child =
$this->info['del']->child = new HTMLPurifier_ChildDef_Chameleon($e__inline, $e__flow);
$this->info['blockquote']->child=
$this->info['dd']->child =
$this->info['li']->child =
@@ -193,6 +194,20 @@ class HTMLPurifier_Definition
$this->info['th']->child = $e_Flow;
$this->info['td']->child = $e_Flow;
//////////////////////////////////////////////////////////////////////
// info[]->type : defines the type of the element (block or inline)
// reuses $e_Inline and $e_block
foreach ($e_Inline->elements as $name) {
$this->info[$name]->type = 'inline';
}
$e_Block = new HTMLPurifier_ChildDef_Optional($e_block);
foreach ($e_Block->elements as $name) {
$this->info[$name]->type = 'block';
}
//////////////////////////////////////////////////////////////////////
// info[]->attr : defines allowed attributes for elements
@@ -249,6 +264,7 @@ class HTMLPurifier_ElementDef
var $attr = array();
var $auto_close = array();
var $child;
var $type = 'unknown';
}