tags:

views:

315

answers:

2

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?

A: 

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
A: 

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