Bugzilla – Bug 540
Discuss overlapping paragraphs. (bug 6507)
Last modified: 2009-05-27 14:36:17 CEST
Index: source =================================================================== --- source (revision 2929) +++ source (revision 2930) @@ -8885,19 +8885,32 @@ since those elements, with their hybrid content models, can straddle paragraph boundaries.</p> + <p class="note">Generally, having elements straddle paragraph + boundaries is best avoided. Maintaining such markup can be + difficult.</p> + + <div class="impl"> + <p>Let <var title="">view</var> be a view of the DOM that replaces all <code>a</code>, <code>ins</code> and <code>del</code> elements in the document with their contents. Then, in <var - title="">view</var>, for each run of <span>phrasing content</span> - uninterrupted by other types of content, in an element that accepts - content other than <span>phrasing content</span>, let <var - title="">first</var> be the first node of the run, and let <var - title="">last</var> be the last node of the run. For each run, a - paragraph exists in the original DOM from immediately before <var - title="">first</var> to immediately after <var - title="">last</var>. (Paragraphs can thus span across + title="">view</var>, for each run of sibling <span>phrasing + content</span> nodes uninterrupted by other types of content, in an + element that accepts content other than <span>phrasing + content</span>, let <var title="">first</var> be the first node of + the run, and let <var title="">last</var> be the last node of the + run. For each such run that consists of at least one node that is + neither <span>embedded content</span> nor <span>inter-element + whitespace</span>, a paragraph exists in the original DOM from + immediately before <var title="">first</var> to immediately after + <var title="">last</var>. (Paragraphs can thus span across <code>a</code>, <code>ins</code> and <code>del</code> elements.)</p> + <p>Conformance checkers may warn authors of cases where they have + paragraphs that overlap each other.</p> + + </div> + <p>A <span>paragraph</span> is also formed explicitly by <code>p</code> elements.</p> @@ -8911,7 +8924,7 @@ <p>In the following example, there are two paragraphs in a section. There is also a header, which contains phrasing content that is not a paragraph. Note how the comments and - <span>intra-element whitespace</span> do not form paragraphs.</p> + <span>inter-element whitespace</span> do not form paragraphs.</p> <pre><section> <h1>Example of paragraphs</h1> @@ -8966,9 +8979,60 @@ </div> - <p class="note">Generally, having elements straddle paragraph - boundaries is best avoided. Maintaining such markup can be - difficult.</p> + <div class="example"> + + <!-- I don't know if there's a better way to deal with this, but if + there is, let me know... --> + + <p>It is possible for paragraphs to overlap when using certain + elements that define fallback content. For example, in the + following section:</p> + + <pre><section> + <h1>My Cats</h1> + You can play with my cat simulator. + <object data="cats.sim"> + To see the cat simulator, use one of the following links: + <ul> + <li><a href="cats.sim">Download simulator file</a> + <li><a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator</a> + </ul> + Alternatively, upgrade to the Mellblom Browser. + </object> + I'm quite proud of it. +</section></pre> + + <p>There are five paragraphs:</p> + + <ol class="brief"> + + <li>The paragraph that says "You can play with my cat + simulator. <i title="">object</i> I'm quite proud of it.", where + <i title="">object</i> is the <code>object</code> element.</li> + + <li>The paragraph that says "To see the cat simulator, use one of + the following links:".</li> + + <li>The paragraph that says "Download simulator file".</li> + + <li>The paragraph that says "Use online simulator".</li> + + <li>The paragraph that says "Alternatively, upgrade to the Mellblom Browser.".</li> + + </ol> + + <p>The first paragraph is overlapped by the other four. A user + agent that supports the "cats.sim" resource will only show the + first one, but a user agent that shows the fallback will + confusingly show the the first sentence of the first paragraph as + if it was in the same paragraph as the second one, and will show + the last paragraph as if it was at the start of the second sentence + of the the first paragraph.</p> + + <p>To avoid this confusion, explicit <code>p</code> elements can be + used.</p> + + </div>