Skip to content

Commit

Permalink
Fix #63: Ban insertNode() of Range's start node
Browse files Browse the repository at this point in the history
  • Loading branch information
ayg committed Oct 6, 2015
1 parent 6287779 commit abad55d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
13 changes: 3 additions & 10 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -7672,17 +7672,10 @@ To <dfn export id=concept-range-insert for=Range>insert</dfn> a <a>node</a>
<var>range</var>, run these steps:

<ol>
<!-- Chrome 12 dev throws "HierarchyRequestError" if node is the same
as the start node (at least for text nodes). This doesn't seem to make
much sense, since insertBefore() works fine to move a node to its current
position, and other browsers disagree, so the spec follows the majority.
-->
<li>If <var>range</var>'s <a>start node</a>
is either a {{ProcessingInstruction}} or {{Comment}}
<a>node</a>, or a {{Text}}
<a>node</a> whose <a>parent</a>
is null, <a>throw</a> an {{HierarchyRequestError}}
exception.
is a {{ProcessingInstruction}} or {{Comment}} <a>node</a>, is a {{Text}}
<a>node</a> whose <a>parent</a> is null, or is <var>node</var>, <a>throw</a>
an {{HierarchyRequestError}} exception.

<!--
Behavior for Text node with null parent:
Expand Down
6 changes: 3 additions & 3 deletions dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-dom.svg"> </a> </p>
<h1 class="p-name no-ref allcaps" id="title">DOM</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2015-10-05">5 October 2015</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2015-10-06">6 October 2015</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>Participate:
Expand Down Expand Up @@ -3613,7 +3613,7 @@ <h3 class="heading settled" data-level="5.2" id="interface-range"><span class="s
<p>To <dfn data-dfn-for="Range" data-dfn-type="dfn" data-export="" id="concept-range-insert">insert<a class="self-link" href="#concept-range-insert"></a></dfn> a <a data-link-type="dfn" href="#concept-node">node</a> <var>node</var> into a <a data-link-type="dfn" href="#concept-range">range</a> <var>range</var>, run these steps:</p>
<ol>
<li>
If <var>range</var>’s <a data-link-type="dfn" href="#concept-range-start-node">start node</a> is either a <code class="idl"><a data-link-type="idl" href="#processinginstruction">ProcessingInstruction</a></code> or <code class="idl"><a data-link-type="idl" href="#comment">Comment</a></code> <a data-link-type="dfn" href="#concept-node">node</a>, or a <code class="idl"><a data-link-type="idl" href="#text">Text</a></code> <a data-link-type="dfn" href="#concept-node">node</a> whose <a data-link-type="dfn" href="#concept-tree-parent">parent</a> is null, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#hierarchyrequesterror">HierarchyRequestError</a></code> exception.
If <var>range</var>’s <a data-link-type="dfn" href="#concept-range-start-node">start node</a> is a <code class="idl"><a data-link-type="idl" href="#processinginstruction">ProcessingInstruction</a></code> or <code class="idl"><a data-link-type="idl" href="#comment">Comment</a></code> <a data-link-type="dfn" href="#concept-node">node</a>, is a <code class="idl"><a data-link-type="idl" href="#text">Text</a></code> <a data-link-type="dfn" href="#concept-node">node</a> whose <a data-link-type="dfn" href="#concept-tree-parent">parent</a> is null, or is <var>node</var>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#hierarchyrequesterror">HierarchyRequestError</a></code> exception.
<p></p>
<li>Let <var>referenceNode</var> be null.
<li>If <var>range</var>’s <a data-link-type="dfn" href="#concept-range-start-node">start node</a> is a <code class="idl"><a data-link-type="idl" href="#text">Text</a></code> <a data-link-type="dfn" href="#concept-node">node</a>,
Expand Down Expand Up @@ -5109,8 +5109,8 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
<li><a href="#queue-a-mutation-observer-compound-microtask">queue a mutation observer compound microtask</a><span>, in §4.3</span>
<li><a href="#queue-a-mutation-record">queue a mutation record</a><span>, in §4.3.2</span>
<li><a href="#concept-document-quirks">quirks mode</a><span>, in §4.5</span>
<li><a href="#range">Range</a><span>, in §5.2</span>
<li><a href="#dom-range-range">Range()</a><span>, in §5.2</span>
<li><a href="#range">Range</a><span>, in §5.2</span>
<li><a href="#concept-range">range</a><span>, in §5.2</span>
<li><a href="#rangeexception">RangeException</a><span>, in §8.3</span>
<li><a href="#concept-MO-queue">record queue</a><span>, in §4.3.1</span>
Expand Down

0 comments on commit abad55d

Please sign in to comment.