From 0231a0a7124475cbdfac3551312b726d14a5d897 Mon Sep 17 00:00:00 2001 From: Patrick Shaughnessy Date: Mon, 9 Dec 2019 17:27:49 -0500 Subject: [PATCH] adding .isConnected DOM attribute --- components/script/dom/node.rs | 5 +++ components/script/dom/webidls/Node.webidl | 3 ++ .../wpt/metadata/dom/idlharness.window.js.ini | 33 ++----------------- .../dom/nodes/Node-isConnected.html.ini | 8 ----- .../option-text-setter.html.ini | 4 --- 5 files changed, 11 insertions(+), 42 deletions(-) delete mode 100644 tests/wpt/metadata/dom/nodes/Node-isConnected.html.ini delete mode 100644 tests/wpt/metadata/html/semantics/forms/the-option-element/option-text-setter.html.ini diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 4885d87c64b..8ee51283146 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2296,6 +2296,11 @@ impl NodeMethods for Node { USVString(String::from(self.owner_doc().base_url().as_str())) } + // https://dom.spec.whatwg.org/#dom-node-isconnected + fn IsConnected(&self) -> bool { + return self.is_connected(); + } + // https://dom.spec.whatwg.org/#dom-node-ownerdocument fn GetOwnerDocument(&self) -> Option> { match self.type_id() { diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl index 6879518b017..c8a71dbebb7 100644 --- a/components/script/dom/webidls/Node.webidl +++ b/components/script/dom/webidls/Node.webidl @@ -28,6 +28,9 @@ interface Node : EventTarget { [Pure] readonly attribute USVString baseURI; + [Pure] + readonly attribute boolean isConnected; + [Pure] readonly attribute Document? ownerDocument; diff --git a/tests/wpt/metadata/dom/idlharness.window.js.ini b/tests/wpt/metadata/dom/idlharness.window.js.ini index 1704974d9ed..b31ff368e3c 100644 --- a/tests/wpt/metadata/dom/idlharness.window.js.ini +++ b/tests/wpt/metadata/dom/idlharness.window.js.ini @@ -17,6 +17,9 @@ [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "nextSibling" with the proper type] expected: FAIL + [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "isConnected" with the proper type] + expected: FAIL + [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "isSameNode(Node)" with the proper type] expected: FAIL @@ -59,21 +62,12 @@ [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "removeChild(Node)" with the proper type] expected: FAIL - [Node interface: element must inherit property "isConnected" with the proper type] - expected: FAIL - - [Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: calling lookupPrefix(DOMString) on document.querySelector("[id\]").attributes[0\] with too few arguments must throw TypeError] expected: FAIL [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "PROCESSING_INSTRUCTION_NODE" with the proper type] expected: FAIL - [Node interface: new Document() must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "baseURI" with the proper type] expected: FAIL @@ -107,12 +101,6 @@ [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "childNodes" with the proper type] expected: FAIL - [Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type] - expected: FAIL - - [Node interface: document.doctype must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "parentElement" with the proper type] expected: FAIL @@ -140,18 +128,9 @@ [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "lookupNamespaceURI(DOMString)" with the proper type] expected: FAIL - [Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: calling lookupNamespaceURI(DOMString) on document.querySelector("[id\]").attributes[0\] with too few arguments must throw TypeError] expected: FAIL - [Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type] - expected: FAIL - - [Node interface: xmlDoc must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "firstChild" with the proper type] expected: FAIL @@ -170,15 +149,9 @@ [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "DOCUMENT_TYPE_NODE" with the proper type] expected: FAIL - [Node interface: attribute isConnected] - expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "hasChildNodes()" with the proper type] expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "isConnected" with the proper type] - expected: FAIL - [Node interface: document.querySelector("[id\]").attributes[0\] must inherit property "lastChild" with the proper type] expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/Node-isConnected.html.ini b/tests/wpt/metadata/dom/nodes/Node-isConnected.html.ini deleted file mode 100644 index 781eb5dc586..00000000000 --- a/tests/wpt/metadata/dom/nodes/Node-isConnected.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[Node-isConnected.html] - type: testharness - [Test with ordinary child nodes] - expected: FAIL - - [Test with iframes] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-option-element/option-text-setter.html.ini b/tests/wpt/metadata/html/semantics/forms/the-option-element/option-text-setter.html.ini deleted file mode 100644 index 994b94e02a2..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-option-element/option-text-setter.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[option-text-setter.html] - [Verify that using HTMLOptionElement.text setter does not update the existing text child node.] - expected: FAIL -