Skip to content

Commit

Permalink
[act] (0) Discuss overlapping paragraphs. (bug 6507)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@2930 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 31, 2009
1 parent 3235852 commit 8999310
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 20 deletions.
80 changes: 72 additions & 8 deletions index
Expand Up @@ -8556,14 +8556,31 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
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 href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements
in the document with their contents. Then, in <var title="">view</var>, for each run of <a href=#phrasing-content-0>phrasing content</a>
uninterrupted by other types of content, in an element that accepts
content other than <a href=#phrasing-content-0>phrasing content</a>, 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
in the document with their contents. Then, in <var title="">view</var>, for each run of sibling <a href=#phrasing-content-0>phrasing
content</a> nodes uninterrupted by other types of content, in an
element that accepts content other than <a href=#phrasing-content-0>phrasing
content</a>, 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 <a href=#embedded-content-2>embedded content</a> nor <a href=#inter-element-whitespace>inter-element
whitespace</a>, 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 href=#the-a-element>a</a></code>, <code><a href=#the-ins-element>ins</a></code> and <code><a href=#the-del-element>del</a></code> elements.)</p>

<p>Conformance checkers may warn authors of cases where they have
paragraphs that overlap each other.</p>

</div>

<p>A <a href=#paragraph>paragraph</a> is also formed explicitly by
<code><a href=#the-p-element>p</a></code> elements.</p>

Expand All @@ -8577,7 +8594,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
<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>
<a href=#inter-element-whitespace>inter-element whitespace</a> do not form paragraphs.</p>

<pre>&lt;section&gt;
&lt;h1&gt;Example of paragraphs&lt;/h1&gt;
Expand Down Expand Up @@ -8632,9 +8649,56 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0

</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>&lt;section&gt;
&lt;h1&gt;My Cats&lt;/h1&gt;
You can play with my cat simulator.
&lt;object data="cats.sim"&gt;
To see the cat simulator, use one of the following links:
&lt;ul&gt;
&lt;li&gt;&lt;a href="cats.sim"&gt;Download simulator file&lt;/a&gt;
&lt;li&gt;&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU"&gt;Use online simulator&lt;/a&gt;
&lt;/ul&gt;
Alternatively, upgrade to the Mellblom Browser.
&lt;/object&gt;
I'm quite proud of it.
&lt;/section&gt;</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><a href=#the-object-element>object</a></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><a href=#the-p-element>p</a></code> elements can be
used.</p>

</div>



Expand Down
88 changes: 76 additions & 12 deletions source
Expand Up @@ -8885,19 +8885,32 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
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>

Expand All @@ -8911,7 +8924,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
<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>&lt;section>
&lt;h1>Example of paragraphs&lt;/h1>
Expand Down Expand Up @@ -8966,9 +8979,60 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0

</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>&lt;section>
&lt;h1>My Cats&lt;/h1>
You can play with my cat simulator.
&lt;object data="cats.sim">
To see the cat simulator, use one of the following links:
&lt;ul>
&lt;li>&lt;a href="cats.sim">Download simulator file&lt;/a>
&lt;li>&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator&lt;/a>
&lt;/ul>
Alternatively, upgrade to the Mellblom Browser.
&lt;/object>
I'm quite proud of it.
&lt;/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>



Expand Down

0 comments on commit 8999310

Please sign in to comment.