Skip to content

Commit

Permalink
Refactor isEqualNode()
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Feb 11, 2014
1 parent e50fd71 commit 0541dc5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 46 deletions.
42 changes: 20 additions & 22 deletions Overview.src.html
Expand Up @@ -3629,19 +3629,15 @@ <h3>Interface <code>Node</code></h3>
<span>context object</span>, with the <i title>clone children flag</i> set
if <var title>deep</var> is true.

<p>The
<dfn title=dom-Node-isEqualNode><code>isEqualNode(<var title>node</var>)</code></dfn>
method must return true if all of the following conditions are true, and
false otherwise:
<p>A <span title=concept-node>node</span> <var title>A</var>
<dfn title=concept-node-equals>equals</dfn> a <span title=concept-node>node</span>
<var title>B</var> if all of the following conditions are true:

<ul>
<li><p><var title>node</var> is not null.
<li><p><var title>node</var>'s
<code title=dom-Node-nodeType>nodeType</code> attribute value is the same
as the <span>context object</span>'s
<code title=dom-Node-nodeType>nodeType</code> attribute value.
<li><p><var title>A</var> and <var title>B</var>'s
<code title=dom-Node-nodeType>nodeType</code> attribute value is identical.
<li>
<p>The following are also equal, depending on <var title>node</var>:
<p>The following are also equal, depending on <var title>A</var>:
<dl class=switch>
<dt><code>DocumentType</code>
<dd><p>Its <span title=concept-doctype-name>name</span>,
Expand Down Expand Up @@ -3672,26 +3668,28 @@ <h3>Interface <code>Node</code></h3>
<dt>Any other node
<dd><p>&mdash;
</dl>
<li><p>If <var title>node</var> is an <code>Element</code>, each
<li><p>If <var title>A</var> is an <span title=concept-element>element</span>, each
<span title=concept-attribute>attribute</span> in its
<span title=concept-element-attribute>attribute list</span> has an
<span title=concept-attribute>attribute</span> with the same
<span title=concept-attribute-namespace>namespace</span>,
<span title=concept-attribute-local-name>local name</span>, and
<span title=concept-attribute-value>value</span> in the
<span>context object</span>'s
<span title=concept-attribute-value>value</span> in <var title>B</var>'s
<span title=concept-element-attribute>attribute list</span>.
<li><p><var title>node</var> has the same number of
<span title=concept-tree-child>children</span> as the
<span>context object</span>.
<li><p>Calling <code title=dom-Node-isEqualNode>isEqualNode()</code> on
each <span title=concept-tree-child>child</span> of the
<span>context object</span>, with the
<span title=concept-tree-child>child</span> of the same index in
<var title>node</var> as argument returns true for every
<span title=concept-tree-child>child</span>.
<li><p><var title>A</var> and <var title>B</var> have the same number of
<span title=concept-tree-child>children</span>.
<li><p>Each <span title=concept-tree-child>child</span> of <var title>A</var>
<span title=concept-node-equals>equals</span> the
<span title=concept-tree-child>child</span> of <var title>B</var> at the identical
<span title=concept-tree-index>index</span>.
</ul>

<p>The
<dfn title=dom-Node-isEqualNode><code>isEqualNode(<var title>node</var>)</code></dfn>
method must return true if <var title>node</var> is not null and
<span>context object</span> <span title=concept-node-equals>equals</span>
<var title>node</var>, and false otherwise.

</div>

<hr>
Expand Down
46 changes: 22 additions & 24 deletions dom-core.html
Expand Up @@ -11,7 +11,7 @@
<p><a class="logo" href="//www.whatwg.org/"><img alt="WHATWG" height="100" src="//resources.whatwg.org/logo-dom.svg" width="100"></a></p>

<h1>DOM</h1>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-10-february-2014">Living Standard — Last Updated 10 February 2014</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-11-february-2014">Living Standard — Last Updated 11 February 2014</h2>

<dl>
<dt>This Version:
Expand Down Expand Up @@ -45,7 +45,7 @@ <h2 class="no-num no-toc" id="living-standard-—-last-updated-10-february-2014"
<p class="copyright"><a href="http://creativecommons.org/publicdomain/zero/1.0/" rel="license"><img alt="CC0" src="http://i.creativecommons.org/p/zero/1.0/80x15.png"></a>
To the extent possible under law, the editors have waived all copyright and
related or neighboring rights to this work. In addition, as of
10 February 2014, the editors have made this specification available
11 February 2014, the editors have made this specification available
under the
<a href="http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0" rel="license">Open Web Foundation Agreement Version 1.0</a>,
which is available at
Expand Down Expand Up @@ -3703,19 +3703,15 @@ <h3 id="interface-node"><span class="secno">5.4 </span>Interface <code><a href="
<a href="#context-object">context object</a>, with the <i title="">clone children flag</i> set
if <var title="">deep</var> is true.

<p>The
<dfn id="dom-node-isequalnode" title="dom-Node-isEqualNode"><code>isEqualNode(<var title="">node</var>)</code></dfn>
method must return true if all of the following conditions are true, and
false otherwise:
<p>A <a href="#concept-node" title="concept-node">node</a> <var title="">A</var>
<dfn id="concept-node-equals" title="concept-node-equals">equals</dfn> a <a href="#concept-node" title="concept-node">node</a>
<var title="">B</var> if all of the following conditions are true:

<ul>
<li><p><var title="">node</var> is not null.
<li><p><var title="">node</var>'s
<code title="dom-Node-nodeType"><a href="#dom-node-nodetype">nodeType</a></code> attribute value is the same
as the <a href="#context-object">context object</a>'s
<code title="dom-Node-nodeType"><a href="#dom-node-nodetype">nodeType</a></code> attribute value.
<li><p><var title="">A</var> and <var title="">B</var>'s
<code title="dom-Node-nodeType"><a href="#dom-node-nodetype">nodeType</a></code> attribute value is identical.
<li>
<p>The following are also equal, depending on <var title="">node</var>:
<p>The following are also equal, depending on <var title="">A</var>:
<dl class="switch">
<dt><code><a href="#documenttype">DocumentType</a></code>
<dd><p>Its <a href="#concept-doctype-name" title="concept-doctype-name">name</a>,
Expand Down Expand Up @@ -3746,26 +3742,28 @@ <h3 id="interface-node"><span class="secno">5.4 </span>Interface <code><a href="
<dt>Any other node
<dd><p>—
</dl>
<li><p>If <var title="">node</var> is an <code><a href="#element">Element</a></code>, each
<li><p>If <var title="">A</var> is an <a href="#concept-element" title="concept-element">element</a>, each
<a href="#concept-attribute" title="concept-attribute">attribute</a> in its
<a href="#concept-element-attribute" title="concept-element-attribute">attribute list</a> has an
<a href="#concept-attribute" title="concept-attribute">attribute</a> with the same
<a href="#concept-attribute-namespace" title="concept-attribute-namespace">namespace</a>,
<a href="#concept-attribute-local-name" title="concept-attribute-local-name">local name</a>, and
<a href="#concept-attribute-value" title="concept-attribute-value">value</a> in the
<a href="#context-object">context object</a>'s
<a href="#concept-attribute-value" title="concept-attribute-value">value</a> in <var title="">B</var>'s
<a href="#concept-element-attribute" title="concept-element-attribute">attribute list</a>.
<li><p><var title="">node</var> has the same number of
<a href="#concept-tree-child" title="concept-tree-child">children</a> as the
<a href="#context-object">context object</a>.
<li><p>Calling <code title="dom-Node-isEqualNode"><a href="#dom-node-isequalnode">isEqualNode()</a></code> on
each <a href="#concept-tree-child" title="concept-tree-child">child</a> of the
<a href="#context-object">context object</a>, with the
<a href="#concept-tree-child" title="concept-tree-child">child</a> of the same index in
<var title="">node</var> as argument returns true for every
<a href="#concept-tree-child" title="concept-tree-child">child</a>.
<li><p><var title="">A</var> and <var title="">B</var> have the same number of
<a href="#concept-tree-child" title="concept-tree-child">children</a>.
<li><p>Each <a href="#concept-tree-child" title="concept-tree-child">child</a> of <var title="">A</var>
<a href="#concept-node-equals" title="concept-node-equals">equals</a> the
<a href="#concept-tree-child" title="concept-tree-child">child</a> of <var title="">B</var> at the identical
<a href="#concept-tree-index" title="concept-tree-index">index</a>.
</ul>

<p>The
<dfn id="dom-node-isequalnode" title="dom-Node-isEqualNode"><code>isEqualNode(<var title="">node</var>)</code></dfn>
method must return true if <var title="">node</var> is not null and
<a href="#context-object">context object</a> <a href="#concept-node-equals" title="concept-node-equals">equals</a>
<var title="">node</var>, and false otherwise.

</div>

<hr>
Expand Down

0 comments on commit 0541dc5

Please sign in to comment.