summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-01-28 20:31:20 +0000
committerAndreas Kling <kling@serenityos.org>2021-01-29 08:49:50 +0100
commit3f5532d43e49e9919a8728c8eb17c625be7e7883 (patch)
tree151d1b166f7c65c13b0ff84d47a7e3d71559acd7 /Userland/Libraries/LibWeb/DOM
parentdbbc378fb2be2fb0f5fe8f767d25b6caf65df3c3 (diff)
downloadserenity-3f5532d43e49e9919a8728c8eb17c625be7e7883.zip
LibWeb: Flesh out prepare_script and execute_script
This fills in a bunch of the FIXMEs that was in prepare_script. execute_script is almost finished, it's just missing the module side. As an aside, let's not assert when inserting a script element with innerHTML.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.h11
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.idl1
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index c7367f6838..be7050b2cc 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -42,6 +42,7 @@
#include <LibWeb/DOM/DOMImplementation.h>
#include <LibWeb/DOM/NonElementParentNode.h>
#include <LibWeb/DOM/ParentNode.h>
+#include <LibWeb/HTML/HTMLScriptElement.h>
namespace Web::DOM {
@@ -220,6 +221,13 @@ public:
const NonnullRefPtr<DOMImplementation> implementation() const { return m_implementation; }
+ RefPtr<HTML::HTMLScriptElement> current_script() const { return m_current_script; }
+ void set_current_script(Badge<HTML::HTMLScriptElement>, RefPtr<HTML::HTMLScriptElement> script) { m_current_script = script; }
+
+ u32 ignore_destructive_writes_counter() const { return m_ignore_destructive_writes_counter; }
+ void increment_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter++; }
+ void decrement_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter--; }
+
virtual EventTarget* get_parent(const Event&) override;
private:
@@ -289,8 +297,11 @@ private:
bool m_ready_for_post_load_tasks { false };
NonnullRefPtr<DOMImplementation> m_implementation;
+ RefPtr<HTML::HTMLScriptElement> m_current_script;
bool m_should_invalidate_styles_on_attribute_changes { true };
+
+ u32 m_ignore_destructive_writes_counter { 0 };
};
}
diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl
index a691c583a2..9aa2878d62 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.idl
+++ b/Userland/Libraries/LibWeb/DOM/Document.idl
@@ -30,6 +30,7 @@ interface Document : Node {
readonly attribute Element? documentElement;
attribute HTMLElement? body;
readonly attribute HTMLHeadElement? head;
+ readonly attribute HTMLScriptElement? currentScript;
readonly attribute DOMString readyState;