0

Currently HTML Tidy is changing any empty HTML tag and combining them into one, for example:

<script src="somescript.js"></script>

Turns into:

<script src="somescript.js" />

This is a problem because including javascript files in the "head" of my HTML is now not working in some browser that explicitly need this closing tag to be separate from the opening tag.

How can I stop Tidy from removing these closing tags?

sebastiaan
  • 5,870
  • 5
  • 38
  • 68
  • 1
    You could just use HTML 4.01 as the output format instead of trying to write HTML Compatible XHTML 1.0. – Quentin May 07 '09 at 08:30

2 Answers2

1

Try sticking some content inside the <script> element, content that won't upset the browser, but which will prevent Tidy from collapsing the tags. Something like whitespace, or a &nbsp;, or a javascript comment.

skaffman
  • 398,947
  • 96
  • 818
  • 769
0

Have you defined a DOCTYPE for your HTML?

Wrapping the close tag into a single tag should work for valid Xhtml, but might upset ye olde html.

Dead account
  • 19,587
  • 13
  • 52
  • 82