Title: [202870] trunk
Revision
202870
Author
[email protected]
Date
2016-07-06 12:54:07 -0700 (Wed, 06 Jul 2016)

Log Message

Add support for Node.isConnected
https://bugs.webkit.org/show_bug.cgi?id=159474
<rdar://problem/27197947>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/dom/interfaces-expected.txt:
Rebaseline now that more checks are passing.

* web-platform-tests/dom/nodes/Node-isConnected-expected.txt: Added.
* web-platform-tests/dom/nodes/Node-isConnected.html: Added.
Import W3C test for Node.isConnected.

Source/WebCore:

Add support for Node.isConnected as per:
- https://dom.spec.whatwg.org/#dom-node-isconnected

Chrome already supports this.

Test: imported/w3c/web-platform-tests/dom/nodes/Node-isConnected.html

* dom/Node.idl:

LayoutTests:

Rebaseline test now that a new property is exposed on nodes.

* js/dom/dom-static-property-for-in-iteration-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202869 => 202870)


--- trunk/LayoutTests/ChangeLog	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/LayoutTests/ChangeLog	2016-07-06 19:54:07 UTC (rev 202870)
@@ -1,3 +1,15 @@
+2016-07-06  Chris Dumez  <[email protected]>
+
+        Add support for Node.isConnected
+        https://bugs.webkit.org/show_bug.cgi?id=159474
+        <rdar://problem/27197947>
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline test now that a new property is exposed on nodes.
+
+        * js/dom/dom-static-property-for-in-iteration-expected.txt:
+
 2016-07-06  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r198928 and r198985.

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (202869 => 202870)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-06 19:54:07 UTC (rev 202870)
@@ -1,3 +1,18 @@
+2016-07-06  Chris Dumez  <[email protected]>
+
+        Add support for Node.isConnected
+        https://bugs.webkit.org/show_bug.cgi?id=159474
+        <rdar://problem/27197947>
+
+        Reviewed by Ryosuke Niwa.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/dom/nodes/Node-isConnected-expected.txt: Added.
+        * web-platform-tests/dom/nodes/Node-isConnected.html: Added.
+        Import W3C test for Node.isConnected.
+
 2016-07-05  Youenn Fablet  <[email protected]>
 
         Refresh WPT tests up to 03916af

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (202869 => 202870)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-07-06 19:54:07 UTC (rev 202870)
@@ -202,7 +202,7 @@
 PASS Node interface: attribute nodeType 
 PASS Node interface: attribute nodeName 
 PASS Node interface: attribute baseURI 
-FAIL Node interface: attribute isConnected assert_true: The prototype object must have a property "isConnected" expected true got false
+PASS Node interface: attribute isConnected 
 PASS Node interface: attribute ownerDocument 
 PASS Node interface: attribute parentNode 
 PASS Node interface: attribute parentElement 
@@ -377,7 +377,7 @@
 PASS Node interface: new Document() must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: new Document() must inherit property "nodeName" with the proper type (13) 
 FAIL Node interface: new Document() must inherit property "baseURI" with the proper type (14) assert_equals: expected "string" but got "object"
-FAIL Node interface: new Document() must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: new Document() must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: new Document() must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: new Document() must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: new Document() must inherit property "parentElement" with the proper type (18) 
@@ -547,7 +547,7 @@
 PASS Node interface: xmlDoc must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: xmlDoc must inherit property "nodeName" with the proper type (13) 
 FAIL Node interface: xmlDoc must inherit property "baseURI" with the proper type (14) assert_equals: expected "string" but got "object"
-FAIL Node interface: xmlDoc must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: xmlDoc must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: xmlDoc must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: xmlDoc must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: xmlDoc must inherit property "parentElement" with the proper type (18) 
@@ -677,7 +677,7 @@
 PASS Node interface: document.doctype must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: document.doctype must inherit property "nodeName" with the proper type (13) 
 PASS Node interface: document.doctype must inherit property "baseURI" with the proper type (14) 
-FAIL Node interface: document.doctype must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: document.doctype must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: document.doctype must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: document.doctype must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: document.doctype must inherit property "parentElement" with the proper type (18) 
@@ -793,7 +793,7 @@
 PASS Node interface: document.createDocumentFragment() must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: document.createDocumentFragment() must inherit property "nodeName" with the proper type (13) 
 PASS Node interface: document.createDocumentFragment() must inherit property "baseURI" with the proper type (14) 
-FAIL Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: document.createDocumentFragment() must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: document.createDocumentFragment() must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: document.createDocumentFragment() must inherit property "parentElement" with the proper type (18) 
@@ -1040,7 +1040,7 @@
 PASS Node interface: element must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: element must inherit property "nodeName" with the proper type (13) 
 FAIL Node interface: element must inherit property "baseURI" with the proper type (14) assert_equals: expected "string" but got "object"
-FAIL Node interface: element must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: element must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: element must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: element must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: element must inherit property "parentElement" with the proper type (18) 
@@ -1221,7 +1221,7 @@
 PASS Node interface: document.createTextNode("abc") must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: document.createTextNode("abc") must inherit property "nodeName" with the proper type (13) 
 PASS Node interface: document.createTextNode("abc") must inherit property "baseURI" with the proper type (14) 
-FAIL Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: document.createTextNode("abc") must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: document.createTextNode("abc") must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: document.createTextNode("abc") must inherit property "parentElement" with the proper type (18) 
@@ -1335,7 +1335,7 @@
 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "nodeName" with the proper type (13) 
 FAIL Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "baseURI" with the proper type (14) assert_equals: expected "string" but got "object"
-FAIL Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentElement" with the proper type (18) 
@@ -1447,7 +1447,7 @@
 PASS Node interface: document.createComment("abc") must inherit property "nodeType" with the proper type (12) 
 PASS Node interface: document.createComment("abc") must inherit property "nodeName" with the proper type (13) 
 PASS Node interface: document.createComment("abc") must inherit property "baseURI" with the proper type (14) 
-FAIL Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15) assert_inherits: property "isConnected" not found in prototype chain
+PASS Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15) 
 PASS Node interface: document.createComment("abc") must inherit property "ownerDocument" with the proper type (16) 
 PASS Node interface: document.createComment("abc") must inherit property "parentNode" with the proper type (17) 
 PASS Node interface: document.createComment("abc") must inherit property "parentElement" with the proper type (18) 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected-expected.txt (0 => 202870)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected-expected.txt	2016-07-06 19:54:07 UTC (rev 202870)
@@ -0,0 +1,4 @@
+
+PASS Test with ordinary child nodes 
+PASS Test with iframes 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected.html (0 => 202870)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-isConnected.html	2016-07-06 19:54:07 UTC (rev 202870)
@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<head>
+<title>Node.prototype.isConnected</title>
+<link rel=help href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+
+"use strict";
+
+test(function() {
+  var nodes = [document.createElement("div"),
+               document.createElement("div"),
+               document.createElement("div")];
+  checkNodes([], nodes);
+
+  // Append nodes[0].
+  document.body.appendChild(nodes[0]);
+  checkNodes([nodes[0]],
+             [nodes[1], nodes[2]]);
+
+  // Append nodes[1] and nodes[2] together.
+  nodes[1].appendChild(nodes[2]);
+  checkNodes([nodes[0]],
+             [nodes[1], nodes[2]]);
+
+  nodes[0].appendChild(nodes[1]);
+  checkNodes(nodes, []);
+
+  // Remove nodes[2].
+  nodes[2].remove();
+  checkNodes([nodes[0], nodes[1]],
+             [nodes[2]]);
+
+  // Remove nodes[0] and nodes[1] together.
+  nodes[0].remove();
+  checkNodes([], nodes);
+}, "Test with ordinary child nodes");
+
+test(function() {
+  var nodes = [document.createElement("iframe"),
+               document.createElement("iframe"),
+               document.createElement("iframe"),
+               document.createElement("iframe"),
+               document.createElement("div")];
+  var frames = [nodes[0],
+                nodes[1],
+                nodes[2],
+                nodes[3]];
+  checkNodes([], nodes);
+
+  // Since we cannot append anything to the contentWindow of an iframe before it
+  // is appended to the main DOM tree, we append the iframes one after another.
+  document.body.appendChild(nodes[0]);
+  checkNodes([nodes[0]],
+             [nodes[1], nodes[2], nodes[3], nodes[4]]);
+
+  frames[0].contentDocument.body.appendChild(nodes[1]);
+  checkNodes([nodes[0], nodes[1]],
+             [nodes[2], nodes[3], nodes[4]]);
+
+  frames[1].contentDocument.body.appendChild(nodes[2]);
+  checkNodes([nodes[0], nodes[1], nodes[2]],
+             [nodes[3], nodes[4]]);
+
+  frames[2].contentDocument.body.appendChild(nodes[3]);
+  checkNodes([nodes[0], nodes[1], nodes[2], nodes[3]],
+             [nodes[4]]);
+
+  frames[3].contentDocument.body.appendChild(nodes[4]);
+  checkNodes(nodes, []);
+
+  frames[3].remove();
+  // Since node[4] is still under the doument of frame[3], it's still connected.
+  checkNodes([nodes[0], nodes[1], nodes[2], nodes[4]],
+             [nodes[3]]);
+
+  frames[0].remove();
+  // Since node[1] and node[2] are still under the doument of frame[0], they are
+  // still connected.
+  checkNodes([nodes[1], nodes[2], nodes[4]],
+             [nodes[0], nodes[3]]);
+}, "Test with iframes");
+
+// This helper function is used to check whether nodes should be connected.
+function checkNodes(aConnectedNodes, aDisconnectedNodes) {
+  aConnectedNodes.forEach(node => assert_true(node.isConnected));
+  aDisconnectedNodes.forEach(node => assert_false(node.isConnected));
+}
+
+</script>
+</body>

Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (202869 => 202870)


--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt	2016-07-06 19:54:07 UTC (rev 202870)
@@ -147,6 +147,7 @@
 PASS a["prefix"] is null
 PASS a["localName"] is a
 PASS a["textContent"] is nerget
+PASS a["isConnected"] is true
 PASS a["parentElement"] is [object HTMLBodyElement]
 PASS a["ELEMENT_NODE"] is 1
 PASS a["ATTRIBUTE_NODE"] is 2

Modified: trunk/Source/WebCore/ChangeLog (202869 => 202870)


--- trunk/Source/WebCore/ChangeLog	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/Source/WebCore/ChangeLog	2016-07-06 19:54:07 UTC (rev 202870)
@@ -1,3 +1,20 @@
+2016-07-06  Chris Dumez  <[email protected]>
+
+        Add support for Node.isConnected
+        https://bugs.webkit.org/show_bug.cgi?id=159474
+        <rdar://problem/27197947>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add support for Node.isConnected as per:
+        - https://dom.spec.whatwg.org/#dom-node-isconnected
+
+        Chrome already supports this.
+
+        Test: imported/w3c/web-platform-tests/dom/nodes/Node-isConnected.html
+
+        * dom/Node.idl:
+
 2016-07-06  Brady Eidson  <[email protected]>
 
         Update IndexedDB's status on the feature page (How had we not done this already?)

Modified: trunk/Source/WebCore/dom/Node.idl (202869 => 202870)


--- trunk/Source/WebCore/dom/Node.idl	2016-07-06 19:17:25 UTC (rev 202869)
+++ trunk/Source/WebCore/dom/Node.idl	2016-07-06 19:54:07 UTC (rev 202870)
@@ -120,6 +120,8 @@
     // FIXME: other should not be optional.
     boolean contains(optional Node? other = null);
 
+    [EnabledAtRuntime=ShadowDOM, ImplementedAs=inDocument] readonly attribute boolean isConnected;
+
     // IE extensions
     readonly attribute Element          parentElement;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to