summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-18 10:29:53 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-18 12:53:06 +0200
commit575e3bf37dc66023c0fb47b93ca3104c85bae683 (patch)
treea9f0cae569cb3db08af79b813fb571c3d3d9c766 /Userland
parent46b8a4cda3fc6680ef444d53a77577d5dd8a4689 (diff)
downloadserenity-575e3bf37dc66023c0fb47b93ca3104c85bae683.zip
LibWeb: Check document fully active status in "element cannot navigate"
This resolves a FIXME and brings us closer to spec.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
index 390e5728b2..6f12735db7 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -196,9 +196,16 @@ int HTMLElement::offset_height() const
return paint_box()->border_box_height();
}
+// https://html.spec.whatwg.org/multipage/links.html#cannot-navigate
bool HTMLElement::cannot_navigate() const
{
- // FIXME: Return true if element's node document is not fully active
+ // An element element cannot navigate if one of the following is true:
+
+ // - element's node document is not fully active
+ if (!document().is_fully_active())
+ return true;
+
+ // - element is not an a element and is not connected.
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}