mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +00:00
Fix broken trusted comments functionality.
This fix is slightly hackish, as we simply treat comments as whitespace. This should largely be correct, and breaks no current test cases, although it could result in noncompliant behavior. Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
parent
b9094d5ec8
commit
07ed1bbf8c
@ -110,7 +110,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
$collection[] = $token;
|
||||
continue;
|
||||
default:
|
||||
if ($token instanceof HTMLPurifier_Token_Text && $token->is_whitespace) {
|
||||
if (!empty($token->is_whitespace)) {
|
||||
$collection[] = $token;
|
||||
$tag_index++;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
|
||||
{
|
||||
public $data; /**< Character data within comment. */
|
||||
public $is_whitespace = true;
|
||||
/**
|
||||
* Transparent constructor.
|
||||
*
|
||||
|
5
tests/HTMLPurifier/HTMLT/trusted-comments-required.htmlt
Normal file
5
tests/HTMLPurifier/HTMLT/trusted-comments-required.htmlt
Normal file
@ -0,0 +1,5 @@
|
||||
--INI--
|
||||
HTML.Trusted = true
|
||||
--HTML--
|
||||
<ul><!-- Foo --></ul>
|
||||
--EXPECT--
|
4
tests/HTMLPurifier/HTMLT/trusted-comments-table.htmlt
Normal file
4
tests/HTMLPurifier/HTMLT/trusted-comments-table.htmlt
Normal file
@ -0,0 +1,4 @@
|
||||
--INI--
|
||||
HTML.Trusted = true
|
||||
--HTML--
|
||||
<table><!-- foo --><tr><td>Foo</td></tr></table>
|
4
tests/HTMLPurifier/HTMLT/trusted-comments.htmlt
Normal file
4
tests/HTMLPurifier/HTMLT/trusted-comments.htmlt
Normal file
@ -0,0 +1,4 @@
|
||||
--INI--
|
||||
HTML.Trusted = true
|
||||
--HTML--
|
||||
<!-- Foobar -->
|
Loading…
Reference in New Issue
Block a user