Skip to content

Commit

Permalink
[giow] (2) Make the formatBlock execCommand more discerning. (bug 6440)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@3123 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 25, 2009
1 parent a78a4c3 commit 40587a8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
42 changes: 27 additions & 15 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 24 May 2009</h2>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 25 May 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -12425,6 +12425,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#sectioning-content-0>Sectioning content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12501,6 +12502,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#sectioning-content-0>Sectioning content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12559,6 +12561,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#sectioning-content-0>Sectioning content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12629,6 +12632,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#sectioning-content-0>Sectioning content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12694,6 +12698,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#heading-content-0>Heading content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand All @@ -12719,6 +12724,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#heading-content-0>Heading content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12776,6 +12782,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12871,6 +12878,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -12929,6 +12937,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13461,6 +13470,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p&gt;

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13614,6 +13624,7 @@ Address: &lt;input name="address"&gt;&lt;/p&gt;</pre>

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13765,6 +13776,7 @@ a friend lost to the
<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#sectioning-root>Sectioning root</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -40319,6 +40331,7 @@ explain that only direct children of the <menu> matter

<dl class=element><dt>Categories</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dd><a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <a href=#flow-content-0>flow content</a> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -56973,8 +56986,8 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<dt><dfn id=command-formatblock title=command-formatBlock><code>formatBlock</code></dfn></dt>
<dd><strong>Summary:</strong> Wraps the selection in the element
given by the second argument. If the second argument doesn't
specify an element that is <a href=#flow-content-0>flow content</a> but not
<a href=#phrasing-content-0>phrasing content</a>, does nothing.</dd>
specify an element that is a <dfn id=formatblock-candidate><code title="">formatBlock</code>
candidate</dfn>, does nothing.</dd>
<dd class=impl>
<p><strong>Action:</strong> The user agent must run the following
steps:</p>
Expand All @@ -56987,18 +57000,17 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<li>
<p>If <var title="">value</var> is (now) an <a href=#ascii-case-insensitive>ASCII
case-insensitive</a> match for the tag name of an element
defined by this specification that is defined to be <a href=#flow-content-0>flow
content</a> but not <a href=#phrasing-content-0>phrasing content</a>, then, for
every position in the selection, take the furthest <a href=#flow-content-0>flow
content</a> ancestor element of that position that contains
only <a href=#phrasing-content-0>phrasing content</a>, and, if that element is
<a href=#editable>editable</a>, and has a content model that allows it to
contain <a href=#flow-content-0>flow content</a> other than <a href=#phrasing-content-0>phrasing
content</a>, and has a parent element whose content model
allows that parent to contain any <a href=#flow-content-0>flow content</a>,
replace the element with one in the HTML namespace whose name is
<var title="">value</var>, and move all the children that were
in the element to the new element.</p>
defined by this specification that is defined to be a
<a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>, then,
for every position in the selection, take the furthest
<a href=#formatblock-candidate><code title="">formatBlock</code> candidate</a>
ancestor element of that position that contains only
<a href=#phrasing-content-0>phrasing content</a>, and, if that element is
<a href=#editable>editable</a> and has a parent element whose content
model allows that parent to contain any <a href=#flow-content-0>flow
content</a>, replace it with an element in the HTML namespace
whose name is <var title="">value</var>, and move all the
children that were in it to the new element.</p>
<p>If there is no selection, then, where in the description
above refers to the selection, the user agent must act as if the
selection was an empty range (with just one position) at the
Expand Down
40 changes: 26 additions & 14 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13247,6 +13247,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Sectioning content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13327,6 +13328,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Sectioning content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13388,6 +13390,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Sectioning content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13466,6 +13469,7 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Sectioning content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13534,6 +13538,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Heading content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13562,6 +13567,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Heading content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13622,6 +13628,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13720,6 +13727,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -13781,6 +13789,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -14373,6 +14382,7 @@ isn't his only passion. He also enjoys other pleasures.&lt;/p>
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -14535,6 +14545,7 @@ Address: &lt;input name="address"&gt;&lt;/p&gt;</pre>
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -14696,6 +14707,7 @@ a friend lost to the
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span>Sectioning root</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -45408,6 +45420,7 @@ explain that only direct children of the <menu> matter
<dl class="element">
<dt>Categories</dt>
<dd><span>Flow content</span>.</dd>
<dd><span><code title="">formatBlock</code> candidate</span>.</dd>
<dt>Contexts in which this element may be used:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dt>Content model:</dt>
Expand Down Expand Up @@ -66807,8 +66820,8 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<dt><dfn title="command-formatBlock"><code>formatBlock</code></dfn></dt>
<dd><strong>Summary:</strong> Wraps the selection in the element
given by the second argument. If the second argument doesn't
specify an element that is <span>flow content</span> but not
<span>phrasing content</span>, does nothing.</dd>
specify an element that is a <dfn><code title="">formatBlock</code>
candidate</dfn>, does nothing.</dd>
<dd class="impl">
<p><strong>Action:</strong> The user agent must run the following
steps:</p>
Expand All @@ -66822,18 +66835,17 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<li>
<p>If <var title="">value</var> is (now) an <span>ASCII
case-insensitive</span> match for the tag name of an element
defined by this specification that is defined to be <span>flow
content</span> but not <span>phrasing content</span>, then, for
every position in the selection, take the furthest <span>flow
content</span> ancestor element of that position that contains
only <span>phrasing content</span>, and, if that element is
<span>editable</span>, and has a content model that allows it to
contain <span>flow content</span> other than <span>phrasing
content</span>, and has a parent element whose content model
allows that parent to contain any <span>flow content</span>,
replace the element with one in the HTML namespace whose name is
<var title="">value</var>, and move all the children that were
in the element to the new element.</p>
defined by this specification that is defined to be a
<span><code title="">formatBlock</code> candidate</span>, then,
for every position in the selection, take the furthest
<span><code title="">formatBlock</code> candidate</span>
ancestor element of that position that contains only
<span>phrasing content</span>, and, if that element is
<span>editable</span> and has a parent element whose content
model allows that parent to contain any <span>flow
content</span>, replace it with an element in the HTML namespace
whose name is <var title="">value</var>, and move all the
children that were in it to the new element.</p>
<p>If there is no selection, then, where in the description
above refers to the selection, the user agent must act as if the
selection was an empty range (with just one position) at the
Expand Down

0 comments on commit 40587a8

Please sign in to comment.