nikerabbit@svn.wikimedia.org schreef:
# Why we don't use Xml::element here?
# Is it because if $source is '', it returns <textarea />?
Yes. <textarea /> violates standards and renders very nastily in Firefox: the rest of the HTML is treated as the textarea's content.
Roan Kattouw (Catrope)
Roan Kattouw wrote:
nikerabbit@svn.wikimedia.org schreef:
# Why we don't use Xml::element here?
# Is it because if $source is '', it returns <textarea />?
Yes. <textarea /> violates standards and renders very nastily in Firefox: the rest of the HTML is treated as the textarea's content.
Note that <textarea /> is perfectly good XHTML, but not compatible with HTML -- where the <element/> form is meaningless and taken to mean <element>.
Since we serve as text/html to be compatible with common browsers (*cough IE cough*) we need to ensure that we only use the short <element/> form for elements which are implicitly closed in HTML 4 (eg, <br/> and <hr/> and <img/>). Anything that must be explicitly closed needs to use the long form with separate opening and closing tags.
-- brion vibber (brion @ wikimedia.org)
On Tue, May 6, 2008 at 4:27 PM, Roan Kattouw roan.kattouw@home.nl wrote:
Yes. <textarea /> violates standards and renders very nastily in Firefox: the rest of the HTML is treated as the textarea's content.
<textarea /> should never be output by anything; elements like <textarea> that can (in this case, must) have content should *always* be output as <textarea></textarea>, for compatibility, although theoretically they're identical. This recommendation is in fact part of the XHTML 1.0 standard, as an informative compatibility guideline:
"Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />)." http://www.w3.org/TR/xhtml1/#C_3
Where we're using XHTML, I would suggest the Xml functions follow this guideline automatically, unless that would cause conflicts with non-XHTML uses of the functions (which I guess hypothetically could exist?).
On Tue, May 6, 2008 at 6:57 PM, Brion Vibber brion@wikimedia.org wrote:
Since we serve as text/html to be compatible with common browsers (*cough IE cough*) we need to ensure that we only use the short <element/> form for elements which are implicitly closed in HTML 4 (eg, <br/> and <hr/> and <img/>).
Last I checked, and Roan's e-mail confirms this, Firefox also barfs on the trailing-slash format for empty elements, even with an XHTML doctype. Or is your point that it doesn't, if the MIME type is for XML?
Anyway, I don't think we would want to serve with an XML MIME type even if IE were out of the picture, given that that means any well-formedness violation is an instant fatal error.
wikitech-l@lists.wikimedia.org