Difference in display between HTML and XHTML

后端 未结 1 1251
滥情空心
滥情空心 2021-01-20 22:19

I thought XHTML documents were supposed to be displayed with exactly the same standards compliance mode as \"strict\" HTML documents.

However, there is a difference

相关标签:
1条回答
  • 2021-01-20 22:57

    The removal of the starting newline is nothing to do with the rendering in HTML, and Dave Raggett's page is just a little imprecise and getting a little out of date. The removal of the starting newline is a property of the HTML parser.

    In the in body tree construction phase the HTML5 spec for the text/html mime type says:

    A start tag whose tag name is one of: "pre", "listing"

    If the stack of open elements has a p element in button scope, then close a p element.

    Insert an HTML element for the token.

    If the next token is a "LF" (U+000A) character token, then ignore that token and move on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)

    Set the frameset-ok flag to "not ok".

    An XML parser is simply not allowed to do this by the XML parsing rules, so XHTML does not drop that new line.

    0 讨论(0)
提交回复
热议问题