#342 Script tag problems

closed-out-of-date
nobody
5
2016-04-03
2008-11-19
Rok Meglič
No

Tidy has some problems with script tag (or it should provide new set of settings to control script indent). Examples:

Before:
<link type="text/css" rel="stylesheet" media="print" href="resources/css/print.css" />
<script type="text/javascript" src="resources/js/jquery.js"></script>
<script type="text/javascript" src="resources/js/main.js"></script>

After:
<link type="text/css" rel="stylesheet" media="print" href="resources/css/print.css" />
<script type="text/javascript" src="resources/js/jquery.js">
</script>
<script type="text/javascript" src="resources/js/main.js">
</script>

Before:
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-6269359-2");
pageTracker._trackPageview();
} catch(err) {}
</script>

After:
</div><script type="text/javascript">
//<![CDATA[

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
//]]>
</script><script type="text/javascript">
//<![CDATA[
try {
var pageTracker = _gat._getTracker("UA-6269359-2");
pageTracker._trackPageview();
} catch(err) {}

//]]>
</script>

Why is tidy doing this?

I'm using PHP 5.2.5, latest version of Tidy.

Discussion

  • Rok Meglič

    Rok Meglič - 2008-11-19

    Test of script tag problems.

     
  • nephylim

    nephylim - 2013-10-11

    Your first example is a BUG because the closing TAG is not indented as it should be. Maybe you can try this patch which is supposed to put both tags on the same line : bug #906

     
  • Geoff

    Geoff - 2016-04-03

    Thanks for the feature request... now so long ago... sorry for the delay...

    Tidy source has moved on to https://github.com/htacg/tidy-html5, site to http://www.html-tidy.org/

    As replied recently on bug #906, if this is just about not putting the </script> on a new line, this this would be a Feature Request, since I am sure some do not mind it being on a new line. Or maybe it is about something else...

    However, if you want to persue this, or find another tidy bug, or feature request, then please file an issue, together with sample html and config used, and if you find, fix, and test the feature in a tidy fork then you can issue a Pull Request. Always appreciated... thanks...

    Tidy needs your support...

    Meantime closing this here as out-of-date...

     
  • Geoff

    Geoff - 2016-04-03
    • status: open --> closed-out-of-date
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks