html - XHTML empty tags not treated as empty tags by any browser -
so i've tried xhtml 1.1 code (validated @ validator.w3.org) in chrome 6, ie 8, , firefox 3.5. <p> following <a/> gets hyperlinked, , <p> following <div/> turns red:
<!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> <title>test</title> </head> <body> <p><a href="http://www.yahoo.com"/></p> <p> should not hyperlinked </p> <div style="background:red"/> <p>this should not red</p> </body> </html> this bad news trying deal documents using xml parsers/generators.
i might able convert </> tags <></>, mean things <br/> become <br></br> -- weird, albeit valid.
thoughts?
if serve document xml content-type (such application/xhtml+xml) shouldn't have problem.
it sounds serving document text/html (although this isn't blessed text/html specification, goes xhtml 1.0) in case need follow the html compatibility guidelines telling browsers (and other user agents) html rather xhtml.
i might able convert
</>tags<></>, mean things<br/>become<br></br>-- weird, albeit valid.
… , wrong. browsers treat <br><br>. elements defined empty should use self-closing syntax, everything else should have explicit start , end tags.
sadly, simple option of using correct content-type introduces different problem…

… although believe resolved when ie8 , lower lose significant market share ie9 introduces support xhtml.
Comments
Post a Comment