Welcome! » Log In » Create A New Profile

html comments inside the script tag

Posted by cogo 
html comments inside the script tag
July 20, 2010 03:27AM

HTMLPurifier is removing HTML comments inside of the <script> tag:

<pre><![CDATA[ <script type="text/javascript"> <!-- some javascript code here //--> </script> ]]></pre>

becomes

<pre><![CDATA[ <script type="text/javascript"> some javascript code here //</script> ]]></pre>

I have set <b>Output.CommentScriptContents</b> to <b>false</b> and <b>HTML.Trusted</b> to <b>true</b>. If I set <b>Output.CommentScriptContents</b> to <b>true</b> HTMLPurifier adds its own comments. I would like it to just keep the comments already there. Is this possible?

Re: html comments inside the script tag
July 20, 2010 08:48PM

Unfortunately not: HTML Purifier's internal representation destroys comment guards and such.

asd
Re: html comments asdasd the script tag
February 14, 2017 06:42AM

fwefwef

kamlesh
testing
February 14, 2017 06:43AM

hello

kamlesh
Re: testing
February 14, 2017 06:45AM

tyty

test123
Re: html comments inside the script tag
April 14, 2017 01:40AM
Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: