Hannes Magnusson skrev:
I don't think nesting <p> tags are a problem in html5.
AFAICT it requires serious willpower to create invalid html5 markup.

HTML introduces a new concept: "conformant". It distinguishes between what browsers should be able to handle (including bad markup) and what authors are required to do (write good markup).

Todays browsers already handle badly written HTML. The new stuff is basically just an effort to make them handle it in a consistent manner, not only as to what graphical result they display, but to what DOM they will produce internally.

I.e. it is very easy to create non conforming HTML 5.

<p>foo <div>bar</div> zoo</p>

Not conformant. The div will close the paragraph. The intended remainder of the paragraph ( zoo) will not be part of it. Neither styles or DOM-manipulation will apply to it. The text will be a sibling node to the paragraph. The end tag will simply be discarded.

This is non-conforming markup. An HTML 5 validor, such as the one being written by Henri Sivonen (http://validator.nu) will complain. In fact, HTML 5 does __not__ lessen the rules on validation. Au cointraire: The rules as tightened up. The following is illegal:

<div>
  <p>foo</p>
  <em>bar</em>
</div>

One must not mix block elements and inline elements or plain text, as children to a block element.


Lars Gunther

Reply via email to