Difference in display between HTML and XHTML -
i thought xhtml documents supposed displayed same standards compliance mode "strict" html documents.
however, there difference in how display pre elements: in html documents, if <pre> start tag followed lf (or crlf), ignored. not in xhtml.
example: html file , xhtml file have same content, rendered differently.
(or if think it's cheating give html file , xhtml file same content, including doctype, here 2 files follow more classic rules: html 4.01 strict , xhtml 1.0 strict.)
so, mean statements this w3c page's
all line breaks , spaces rendered appear in html. exception newline after start tag <pre> , before end tag </pre>, discarded.
are valid html, not xhtml? haven't found indication xhtml can display things differently if likes. browsers i've tested do.
the removal of starting newline nothing rendering in html, , dave raggett's page little imprecise , getting little out of date. removal of starting newline property of html parser.
in in body tree construction phase html5 spec text/html mime type says:
a start tag tag name 1 of: "pre", "listing"
if stack of open elements has p element in button scope, close p element.
insert html element token.
if next token "lf" (u+000a) character token, ignore token , move on next one. (newlines @ start of pre blocks ignored authoring convenience.)
set frameset-ok flag "not ok".
an xml parser not allowed xml parsing rules, xhtml not drop new line.
Comments
Post a Comment