Why is a single textarea a mess of all the following xhtml?

I am having a problem in my web program. I got a textarea in my form, sometimes there is nothing in the textarea, so the genshi templating engine just outputs it as

<textarea xxxx />

      

and this is where the problem comes in, all the following tags are in the textbox. Why can't the whole browser handle the individual text boxes correctly?

If I write it like

<textarea xxxx></textarea>

      

and everything works fine. Why one textbox messes the following tags in xhtml?

+2


source to share


1 answer


As you are presumably using your XHTML with text / html Content-type and making it render as HTML. XML-style self-closing tags do not exist in HTML (so you need to use explicit start and end tags unless they are prohibited (like end tags on img) or optional (like start and end tags for the body element).

If you want your pages to be rendered as XHTML you can use the app / xhtml + xml (and kiss goodbye to keep it running in Internet Explorer).



(This is why I am sticking with HTML 4.01 for most projects)

See http://www.w3.org/TR/xhtml-media-types/ for details (including a full set of compatibility guidelines for turning your XHTML into a form that HTML user agents can handle).

+4


source







All Articles