<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189225] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189225">189225</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-01 13:46:33 -0700 (Tue, 01 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Range.insersectsNode(node) is supposed to return true if node.parent is null
https://bugs.webkit.org/show_bug.cgi?id=148687

Reviewed by Ryosuke Niwa.

Source/WebCore:

Range.insersectsNode(node) is supposed to return true if node.parent is
null:
https://dom.spec.whatwg.org/#dom-range-intersectsnode (step 3)

Previously, WebKit would throw a NotFoundError, apparently to match
Firefox's behavior. However, these days, Firefox complies with the
specification and returns true here.

No new tests, already covered by:
http/tests/w3c/dom/ranges/Range-intersectsNode.html (rebaselined)

* dom/Range.cpp:
(WebCore::Range::intersectsNode):

LayoutTests:

Rebaseline / update existing tests.

* fast/dom/Range/range-intersectsNode-expected.txt:
* fast/dom/Range/resources/intersectsNode.js:
* http/tests/w3c/dom/nodes/Element-matches-expected.txt:
* http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomRangerangeintersectsNodeexpectedtxt">trunk/LayoutTests/fast/dom/Range/range-intersectsNode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomRangeresourcesintersectsNodejs">trunk/LayoutTests/fast/dom/Range/resources/intersectsNode.js</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomnodesElementmatchesexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomrangesRangeintersectsNodeexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/LayoutTests/ChangeLog        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-01  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Range.insersectsNode(node) is supposed to return true if node.parent is null
+        https://bugs.webkit.org/show_bug.cgi?id=148687
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline / update existing tests.
+
+        * fast/dom/Range/range-intersectsNode-expected.txt:
+        * fast/dom/Range/resources/intersectsNode.js:
+        * http/tests/w3c/dom/nodes/Element-matches-expected.txt:
+        * http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt:
+
</ins><span class="cx"> 2015-09-01  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Repaint cleanup:
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomRangerangeintersectsNodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Range/range-intersectsNode-expected.txt (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/range-intersectsNode-expected.txt        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/LayoutTests/fast/dom/Range/range-intersectsNode-expected.txt        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS intersects is false
</span><span class="cx"> 
</span><span class="cx"> 2.3 Node has no parent
</span><del>-PASS range.intersectsNode(document) threw exception Error: NotFoundError: DOM Exception 8.
</del><ins>+PASS range.intersectsNode(document) is true
</ins><span class="cx"> 
</span><span class="cx"> 2.4 Range has no parent
</span><span class="cx"> PASS range.selectNode(document) threw exception Error: InvalidNodeTypeError: DOM Exception 24.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomRangeresourcesintersectsNodejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Range/resources/intersectsNode.js (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/resources/intersectsNode.js        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/LayoutTests/fast/dom/Range/resources/intersectsNode.js        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> 
</span><span class="cx"> debug(&quot;2.3 Node has no parent&quot;);
</span><span class="cx"> range.selectNode(document.getElementById(&quot;a2&quot;));
</span><del>-shouldThrow(&quot;range.intersectsNode(document)&quot;);
</del><ins>+shouldBeTrue(&quot;range.intersectsNode(document)&quot;);
</ins><span class="cx"> debug(&quot;&quot;);
</span><span class="cx"> 
</span><span class="cx"> debug(&quot;2.4 Range has no parent&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomnodesElementmatchesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx"> PASS In-document Element.matches: :empty pseudo-class selector, matching all empty elements (with no refNodes): #pseudo-empty :empty 
</span><span class="cx"> PASS In-document Element.matches: :link and :visited pseudo-class selectors, matching a and area elements with href attributes (with no refNodes): #pseudo-link :link, #pseudo-link :visited 
</span><span class="cx"> PASS In-document Element.matches: :link and :visited pseudo-class selectors, matching link elements with href attributes (with no refNodes): #head :link, #head :visited 
</span><del>-FAIL In-document Element.matches: :target pseudo-class selector, matching the element referenced by the URL fragment identifier (with no refNodes): :target assert_true: The element #target should match the selector. expected true got false
</del><ins>+PASS In-document Element.matches: :target pseudo-class selector, matching the element referenced by the URL fragment identifier (with no refNodes): :target 
</ins><span class="cx"> PASS In-document Element.matches: :lang pseudo-class selector, matching inherited language (with no refNodes): #pseudo-lang-div1:lang(en) 
</span><span class="cx"> PASS In-document Element.matches: :lang pseudo-class selector, matching specified language with exact value (with no refNodes): #pseudo-lang-div2:lang(fr) 
</span><span class="cx"> PASS In-document Element.matches: :lang pseudo-class selector, matching specified language with partial value (with no refNodes): #pseudo-lang-div3:lang(en) 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomrangesRangeintersectsNodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/LayoutTests/http/tests/w3c/dom/ranges/Range-intersectsNode-expected.txt        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -426,67 +426,67 @@
</span><span class="cx"> PASS Node 6 detachedPara1.firstChild, range 57 [detachedForeignComment, 4, detachedForeignComment, 4] 
</span><span class="cx"> PASS Node 6 detachedPara1.firstChild, range 58 [foreignDocfrag, 0, foreignDocfrag, 0] 
</span><span class="cx"> PASS Node 6 detachedPara1.firstChild, range 59 [xmlDocfrag, 0, xmlDocfrag, 0] 
</span><del>-FAIL Node 7 document, detached range NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 10 [document.documentElement, 0, document.documentElement, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 11 [document.documentElement, 0, document.documentElement, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 12 [document.documentElement, 1, document.documentElement, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 13 [document.head, 1, document.head, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 14 [document.body, 4, document.body, 5] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 16 [paras[0], 0, paras[0], 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 17 [detachedPara1, 0, detachedPara1, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 20 [paras[0].firstChild, 3, paras[3], 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 21 [paras[0], 0, paras[0].firstChild, 7] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 22 [testDiv, 2, paras[4], 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 23 [document, 0, document, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 24 [document, 0, document, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 25 [comment, 2, comment, 3] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 26 [testDiv, 0, comment, 5] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 27 [foreignDoc, 1, foreignComment, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 28 [foreignDoc.body, 0, foreignTextNode, 36] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 29 [xmlDoc, 1, xmlComment, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 30 [detachedTextNode, 0, detachedTextNode, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 33 [detachedComment, 3, detachedComment, 4] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 34 [detachedForeignComment, 0, detachedForeignComment, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 35 [detachedXmlComment, 2, detachedXmlComment, 6] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 36 [docfrag, 0, docfrag, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 37 [processingInstruction, 0, processingInstruction, 4] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 38 [paras[1].firstChild, 0, paras[1].firstChild, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 39 [paras[1].firstChild, 2, paras[1].firstChild, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 40 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 41 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 42 [foreignDoc.head, 1, foreignDoc.head, 1] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 43 [foreignDoc.body, 0, foreignDoc.body, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 44 [paras[0], 0, paras[0], 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 45 [detachedPara1, 0, detachedPara1, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 46 [testDiv, 1, paras[2].firstChild, 5] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 47 [document.documentElement, 1, document.body, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 48 [foreignDoc.documentElement, 1, foreignDoc.body, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 49 [document, 1, document, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 50 [paras[2].firstChild, 4, comment, 2] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 51 [paras[3], 1, comment, 8] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 52 [foreignDoc, 0, foreignDoc, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 53 [xmlDoc, 0, xmlDoc, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 54 [detachedForeignTextNode, 7, detachedForeignTextNode, 7] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 55 [detachedXmlTextNode, 7, detachedXmlTextNode, 7] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 56 [detachedComment, 5, detachedComment, 5] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 57 [detachedForeignComment, 4, detachedForeignComment, 4] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 58 [foreignDocfrag, 0, foreignDocfrag, 0] NotFoundError: DOM Exception 8
-FAIL Node 7 document, range 59 [xmlDocfrag, 0, xmlDocfrag, 0] NotFoundError: DOM Exception 8
</del><ins>+PASS Node 7 document, detached range 
+PASS Node 7 document, range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0] 
+PASS Node 7 document, range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1] 
+PASS Node 7 document, range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8] 
+PASS Node 7 document, range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9] 
+PASS Node 7 document, range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0] 
+PASS Node 7 document, range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9] 
+PASS Node 7 document, range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0] 
+PASS Node 7 document, range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8] 
+PASS Node 7 document, range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0] 
+PASS Node 7 document, range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8] 
+PASS Node 7 document, range 10 [document.documentElement, 0, document.documentElement, 1] 
+PASS Node 7 document, range 11 [document.documentElement, 0, document.documentElement, 2] 
+PASS Node 7 document, range 12 [document.documentElement, 1, document.documentElement, 2] 
+PASS Node 7 document, range 13 [document.head, 1, document.head, 1] 
+PASS Node 7 document, range 14 [document.body, 4, document.body, 5] 
+PASS Node 7 document, range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1] 
+PASS Node 7 document, range 16 [paras[0], 0, paras[0], 1] 
+PASS Node 7 document, range 17 [detachedPara1, 0, detachedPara1, 1] 
+PASS Node 7 document, range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0] 
+PASS Node 7 document, range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8] 
+PASS Node 7 document, range 20 [paras[0].firstChild, 3, paras[3], 1] 
+PASS Node 7 document, range 21 [paras[0], 0, paras[0].firstChild, 7] 
+PASS Node 7 document, range 22 [testDiv, 2, paras[4], 1] 
+PASS Node 7 document, range 23 [document, 0, document, 1] 
+PASS Node 7 document, range 24 [document, 0, document, 2] 
+PASS Node 7 document, range 25 [comment, 2, comment, 3] 
+PASS Node 7 document, range 26 [testDiv, 0, comment, 5] 
+PASS Node 7 document, range 27 [foreignDoc, 1, foreignComment, 2] 
+PASS Node 7 document, range 28 [foreignDoc.body, 0, foreignTextNode, 36] 
+PASS Node 7 document, range 29 [xmlDoc, 1, xmlComment, 0] 
+PASS Node 7 document, range 30 [detachedTextNode, 0, detachedTextNode, 8] 
+PASS Node 7 document, range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8] 
+PASS Node 7 document, range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8] 
+PASS Node 7 document, range 33 [detachedComment, 3, detachedComment, 4] 
+PASS Node 7 document, range 34 [detachedForeignComment, 0, detachedForeignComment, 1] 
+PASS Node 7 document, range 35 [detachedXmlComment, 2, detachedXmlComment, 6] 
+PASS Node 7 document, range 36 [docfrag, 0, docfrag, 0] 
+PASS Node 7 document, range 37 [processingInstruction, 0, processingInstruction, 4] 
+PASS Node 7 document, range 38 [paras[1].firstChild, 0, paras[1].firstChild, 1] 
+PASS Node 7 document, range 39 [paras[1].firstChild, 2, paras[1].firstChild, 8] 
+PASS Node 7 document, range 40 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 1] 
+PASS Node 7 document, range 41 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 1] 
+PASS Node 7 document, range 42 [foreignDoc.head, 1, foreignDoc.head, 1] 
+PASS Node 7 document, range 43 [foreignDoc.body, 0, foreignDoc.body, 0] 
+PASS Node 7 document, range 44 [paras[0], 0, paras[0], 0] 
+PASS Node 7 document, range 45 [detachedPara1, 0, detachedPara1, 0] 
+PASS Node 7 document, range 46 [testDiv, 1, paras[2].firstChild, 5] 
+PASS Node 7 document, range 47 [document.documentElement, 1, document.body, 0] 
+PASS Node 7 document, range 48 [foreignDoc.documentElement, 1, foreignDoc.body, 0] 
+PASS Node 7 document, range 49 [document, 1, document, 2] 
+PASS Node 7 document, range 50 [paras[2].firstChild, 4, comment, 2] 
+PASS Node 7 document, range 51 [paras[3], 1, comment, 8] 
+PASS Node 7 document, range 52 [foreignDoc, 0, foreignDoc, 0] 
+PASS Node 7 document, range 53 [xmlDoc, 0, xmlDoc, 0] 
+PASS Node 7 document, range 54 [detachedForeignTextNode, 7, detachedForeignTextNode, 7] 
+PASS Node 7 document, range 55 [detachedXmlTextNode, 7, detachedXmlTextNode, 7] 
+PASS Node 7 document, range 56 [detachedComment, 5, detachedComment, 5] 
+PASS Node 7 document, range 57 [detachedForeignComment, 4, detachedForeignComment, 4] 
+PASS Node 7 document, range 58 [foreignDocfrag, 0, foreignDocfrag, 0] 
+PASS Node 7 document, range 59 [xmlDocfrag, 0, xmlDocfrag, 0] 
</ins><span class="cx"> PASS Node 8 detachedDiv, detached range 
</span><span class="cx"> PASS Node 8 detachedDiv, range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0] 
</span><span class="cx"> PASS Node 8 detachedDiv, range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1] 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/Source/WebCore/ChangeLog        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-09-01  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Range.insersectsNode(node) is supposed to return true if node.parent is null
+        https://bugs.webkit.org/show_bug.cgi?id=148687
+
+        Reviewed by Ryosuke Niwa.
+
+        Range.insersectsNode(node) is supposed to return true if node.parent is
+        null:
+        https://dom.spec.whatwg.org/#dom-range-intersectsnode (step 3)
+
+        Previously, WebKit would throw a NotFoundError, apparently to match
+        Firefox's behavior. However, these days, Firefox complies with the
+        specification and returns true here.
+
+        No new tests, already covered by:
+        http/tests/w3c/dom/ranges/Range-intersectsNode.html (rebaselined)
+
+        * dom/Range.cpp:
+        (WebCore::Range::intersectsNode):
+
</ins><span class="cx"> 2015-09-01  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: tighten up lifetimes for InspectorController-owned objects; add brace initializers to agents
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (189224 => 189225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2015-09-01 19:01:31 UTC (rev 189224)
+++ trunk/Source/WebCore/dom/Range.cpp        2015-09-01 20:46:33 UTC (rev 189225)
</span><span class="lines">@@ -501,12 +501,8 @@
</span><span class="cx">     ContainerNode* parentNode = refNode-&gt;parentNode();
</span><span class="cx">     unsigned nodeIndex = refNode-&gt;computeNodeIndex();
</span><span class="cx">     
</span><del>-    if (!parentNode) {
-        // if the node is the top document we should return NODE_BEFORE_AND_AFTER
-        // but we throw to match firefox behavior
-        ec = NOT_FOUND_ERR;
-        return false;
-    }
</del><ins>+    if (!parentNode)
+        return true;
</ins><span class="cx"> 
</span><span class="cx">     if (comparePoint(parentNode, nodeIndex, ec) &lt; 0 &amp;&amp; // starts before start
</span><span class="cx">         comparePoint(parentNode, nodeIndex + 1, ec) &lt; 0) { // ends before start
</span></span></pre>
</div>
</div>

</body>
</html>