Skip to content

Commit

Permalink
Make cloneNode() throw for ShadowRoot objects
Browse files Browse the repository at this point in the history
See WICG/webcomponents#393 for context.
  • Loading branch information
annevk committed Feb 24, 2016
1 parent 5a20a8f commit 02ec9c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 10 additions & 3 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3569,9 +3569,16 @@ dom-Range-extractContents, dom-Range-cloneContents -->
<li>Return <var>copy</var>.
</ol>

The <dfn method for=Node><code>cloneNode(<var>deep</var>)</code></dfn> method, when
invoked, must return a <a lt="clone a node">clone</a> of the <a>context object</a>, with
the <i>clone children flag</i> set if <var>deep</var> is true.
<p>The <dfn method for=Node><code>cloneNode(<var>deep</var>)</code></dfn> method, when
invoked, must run these steps:

<ol>
<li><p>If <a>context object</a> is a <a>shadow root</a>, <a>throw</a> a {{NotSupportedError}}
exception.

<li><p>Return a <a lt="clone a node">clone</a> of the <a>context object</a>, with the
<i>clone children flag</i> set if <var>deep</var> is true.
</ol>

A <a>node</a> <var>A</var>
<dfn export for=Node id=concept-node-equals>equals</dfn> a <a>node</a>
Expand Down
9 changes: 7 additions & 2 deletions dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -2043,8 +2043,13 @@ <h3 class="heading settled" data-level="4.4" id="interface-node"><span class="se
<li>Return <var>copy</var>.
</ol>
<p>The <dfn class="idl-code" data-dfn-for="Node" data-dfn-type="method" data-export="" data-lt="cloneNode(deep)|cloneNode()" id="dom-node-clonenode"><code>cloneNode(<var>deep</var>)</code><a class="self-link" href="#dom-node-clonenode"></a></dfn> method, when
invoked, must return a <a data-link-type="dfn" href="#concept-node-clone">clone</a> of the <a data-link-type="dfn" href="#context-object">context object</a>, with
the <i>clone children flag</i> set if <var>deep</var> is true.</p>
invoked, must run these steps: </p>
<ol>
<li>
<p>If <a data-link-type="dfn" href="#context-object">context object</a> is a <a data-link-type="dfn" href="https://w3c.github.io/webcomponents/spec/shadow/#dfn-shadow-root">shadow root</a>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notsupportederror">NotSupportedError</a></code> exception. </p>
<li>
<p>Return a <a data-link-type="dfn" href="#concept-node-clone">clone</a> of the <a data-link-type="dfn" href="#context-object">context object</a>, with the <i>clone children flag</i> set if <var>deep</var> is true. </p>
</ol>
<p>A <a data-link-type="dfn" href="#concept-node">node</a> <var>A</var> <dfn data-dfn-for="Node" data-dfn-type="dfn" data-export="" id="concept-node-equals">equals<a class="self-link" href="#concept-node-equals"></a></dfn> a <a data-link-type="dfn" href="#concept-node">node</a> <var>B</var> if all of the following conditions are true:</p>
<ul>
<li><var>A</var> and <var>B</var>’s <code class="idl"><a data-link-type="idl" href="#dom-node-nodetype">nodeType</a></code> attribute value is identical.
Expand Down

0 comments on commit 02ec9c7

Please sign in to comment.