views:

160

answers:

3

Apache tiles converts open tag and close tag with no content to an empty tag.

For example <script src="some.js"></script> will be written as <script src="some.js"/>, which breaks my HTML.

How to prevent this behaviour?

A: 

I don't suppose this works?

<script src="some.js" type="text/javascript"></script>

or

<script src="some.js" type="text/javascript">&nbsp;</script>

Not too sure the above would even solve the validation issue, even if it did work

wiifm
This Don't work.
alex
A: 

Does it really "break your HTML"? Did you check with a validator, like validator.w3.org? You are describing perfectly valid XML. To which DTD should your HTML conform? Personally, I would aim for XHTML, where this is not a problem.

Edit: Is your server delivering text/html or application/xhtml+xml? It seems some browser will not be too happy with XHTML delivered as text/html.

ShiDoiSi
This is not a validation issue. Page displays incorrect in my browser, because some HTML tags required to be ended, such as textarea or script.
alex
Try this HTML code with not ended script tag. The body wouldn't be displayed.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" src="some.js" /><title>Forum</title></head><body>Some content</body></html>
alex
A: 

You need to put some content in between the script start and end tags, enough to stop Tiles from collapsing it down. Try some white space, or a line break, or even a &nbsp;. If Tiles keeps doing it, you need to introduce some content in there that it won't collapse, perhaps a javascript comment?

skaffman
Comment doesn't work, but   or some content works. But what about textarea tag, if I don't whant any content in it?
alex