mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +00:00
[SafeScripting] disable autoclosing of <script /> tag (#198)
This commit is contained in:
parent
b74425bee5
commit
5a01e6535d
@ -410,7 +410,7 @@
|
|||||||
</directive>
|
</directive>
|
||||||
<directive id="Core.EnableIDNA">
|
<directive id="Core.EnableIDNA">
|
||||||
<file name="HTMLPurifier/AttrDef/URI/Host.php">
|
<file name="HTMLPurifier/AttrDef/URI/Host.php">
|
||||||
<line>105</line>
|
<line>109</line>
|
||||||
</file>
|
</file>
|
||||||
</directive>
|
</directive>
|
||||||
<directive id="Attr.DefaultTextDir">
|
<directive id="Attr.DefaultTextDir">
|
||||||
|
@ -23,7 +23,7 @@ class HTMLPurifier_HTMLModule_SafeScripting extends HTMLPurifier_HTMLModule
|
|||||||
$script = $this->addElement(
|
$script = $this->addElement(
|
||||||
'script',
|
'script',
|
||||||
'Inline',
|
'Inline',
|
||||||
'Empty',
|
'Optional:', // Not `Empty` to not allow to autoclose the <script /> tag @see https://www.w3.org/TR/html4/interact/scripts.html
|
||||||
null,
|
null,
|
||||||
array(
|
array(
|
||||||
// While technically not required by the spec, we're forcing
|
// While technically not required by the spec, we're forcing
|
||||||
|
@ -20,7 +20,15 @@ class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleH
|
|||||||
public function testGood()
|
public function testGood()
|
||||||
{
|
{
|
||||||
$this->assertResult(
|
$this->assertResult(
|
||||||
'<script type="text/javascript" src="http://localhost/foo.js" />'
|
'<script type="text/javascript" src="http://localhost/foo.js"></script>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGoodWithAutoclosedTag()
|
||||||
|
{
|
||||||
|
$this->assertResult(
|
||||||
|
'<script type="text/javascript" src="http://localhost/foo.js"/>',
|
||||||
|
'<script type="text/javascript" src="http://localhost/foo.js"></script>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user