summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2021-04-10 10:34:58 -0700
committerAndreas Kling <kling@serenityos.org>2021-04-11 09:40:06 +0200
commit0f8932d7ab1bdf598011e138377461fe1f731fa5 (patch)
treefe38fde3d5af11c9b51de483edfbbaa954b0d687 /Userland/Libraries
parent437a214085641340b6463b1f0fc7534418bf9734 (diff)
downloadserenity-0f8932d7ab1bdf598011e138377461fe1f731fa5.zip
LibWeb: Connect existing implementation of Node::is_connected to JS.
I was looking at implementing something else, and saw this was low hanging fruit, that brings the browser closer to standards conformance. Add a basic test as well to validate it's implementation.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.idl1
-rw-r--r--Userland/Libraries/LibWeb/Tests/DOM/Node.js11
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.idl b/Userland/Libraries/LibWeb/DOM/Node.idl
index 5667340c8c..cf98316266 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.idl
+++ b/Userland/Libraries/LibWeb/DOM/Node.idl
@@ -12,6 +12,7 @@ interface Node : EventTarget {
readonly attribute Node? nextSibling;
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
+ readonly attribute boolean isConnected;
attribute DOMString textContent;
Node appendChild(Node node);
diff --git a/Userland/Libraries/LibWeb/Tests/DOM/Node.js b/Userland/Libraries/LibWeb/Tests/DOM/Node.js
index 5427d143bd..47c3e1c668 100644
--- a/Userland/Libraries/LibWeb/Tests/DOM/Node.js
+++ b/Userland/Libraries/LibWeb/Tests/DOM/Node.js
@@ -25,4 +25,15 @@ afterInitialPageLoad(() => {
HIDDEN TEXT
`);
});
+
+ test("Node.isConnected", () => {
+ var element = document.createElement("p");
+ expect(element.isConnected).toBeFalse();
+
+ document.body.appendChild(element);
+ expect(element.isConnected).toBeTrue();
+
+ document.body.removeChild(element);
+ expect(element.isConnected).toBeFalse();
+ });
});