E
E
entermix2015-02-05 01:33:05
Kohana
entermix, 2015-02-05 01:33:05

Why does HTMLPurifier work this way?

I installed the HTMLPurifier template for Kohana, trying to filter the text (with the default HTMLPurifier settings):

<script type="text/javascript">
<!--
  alert('1');
-->
</script>

As a result I get:
<script type="text/javascript"><!--//--><![CDATA[//><!--
alert('1');
//--><!]]></script>

Но этот код успешно выполняется в браузере, почему так?
Может есть пример настроек HTMLPurifier для Kohana ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rikcon, 2015-02-05
@Rikcon

Why did you put HTML comments into JS?
Everything is simpler, even if you write in the html tag <script> </script> , it's still javascript, and you need to comment it as if you were commenting the js file.
That is NOT

<script type="text/javascript">
<!--
  alert('1');
-->
</script>

BUT:
<script type="text/javascript">
  //alert('1');
</script>

Even the toaster parser understood me correctly, and highlighted the comment only in 2 cases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question