mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
- Restore substr_count compatibility method; it's not just PHP 4
- Update missing includes - Fix generate-standalone.php fatal error - Make LexerTest resilient against variant versions of libxml git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1573 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -510,6 +510,26 @@ class HTMLPurifier_LexerTest extends HTMLPurifier_Harness
|
||||
}
|
||||
|
||||
function test_tokenizeHTML_() {
|
||||
$extra = array(
|
||||
// PH5P doesn't seem to like style tags
|
||||
'PH5P' => false,
|
||||
// DirectLex defers to RemoveForeignElements for textification
|
||||
'DirectLex' => array(
|
||||
new HTMLPurifier_Token_Start('style', array('type' => 'text/css')),
|
||||
new HTMLPurifier_Token_Comment("\ndiv {}\n"),
|
||||
new HTMLPurifier_Token_End('style'),
|
||||
),
|
||||
);
|
||||
if (!defined('LIBXML_VERSION') || LIBXML_VERSION < 20628) {
|
||||
// libxml's behavior is wrong prior to this version, so make
|
||||
// appropriate accomodations
|
||||
// :NOTE: LIBXML_VERSION is missing in early versions of PHP
|
||||
// prior to 1.30 of php-src/ext/libxml/libxml.c (version-wise,
|
||||
// this translates to 5.0.x. In such cases, we assume that an old
|
||||
// version of libxml is being used, although that *might* not
|
||||
// be the case (it's very unlikely though)
|
||||
$extra['DOMLex'] = $extra['DirectLex'];
|
||||
}
|
||||
$this->assertTokenization(
|
||||
'<style type="text/css"><!--
|
||||
div {}
|
||||
@@ -519,16 +539,7 @@ div {}
|
||||
new HTMLPurifier_Token_Text("\ndiv {}\n"),
|
||||
new HTMLPurifier_Token_End('style'),
|
||||
),
|
||||
array(
|
||||
// PH5P doesn't seem to like style tags
|
||||
'PH5P' => false,
|
||||
// DirectLex defers to RemoveForeignElements for textification
|
||||
'DirectLex' => array(
|
||||
new HTMLPurifier_Token_Start('style', array('type' => 'text/css')),
|
||||
new HTMLPurifier_Token_Comment("\ndiv {}\n"),
|
||||
new HTMLPurifier_Token_End('style'),
|
||||
),
|
||||
)
|
||||
$extra
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user