1
Vote

Beautifing when "<script>" exists in code

description

Hi,
 
Nice job for converting the JS to C#.
 
In genral this works well but i had a problem with using your lib when a JS has "<script>" string inside is.
 
See an example:
 
Source JavaScript to beautify:
 
var srt = '<script>var someData="Ariel";</script>';
 
Beautify by your lib (added scripts tag):
 
<script type="text/javascript">
var srt = '<script>var someData="Ariel";';
</script>
 
Beautify by 'jsbeautifier.org' (nothing changed):
 
var srt = '<script>var someData="Ariel";</script>';
 
 
I compared the source code inside you lib against 'jsbeautifier.org' and found a spcial replacement inside yours which dosn't exist in 'jsbeautifier.org':
 
input = js_source_text.Replace("<script type=\"text/javascript\">", "").Replace("</script>", "");
if (input.Length != js_source_text.Length)
{
output.AppendLine("<script type=\"text/javascript\">");
add_script_tags = true;
}
 
I tried removing it but many exceptions started to popup..
Is there any reason why this block of code was added?
 
 
Thank you
Ariel Deil

comments