diff --git a/Tests/LibWeb/Text/expected/synthetic-event-constructor-istrusted-check.txt b/Tests/LibWeb/Text/expected/synthetic-event-constructor-istrusted-check.txt
new file mode 100644
index 00000000000..b4b47ef2487
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/synthetic-event-constructor-istrusted-check.txt
@@ -0,0 +1 @@
+new Event('x').isTrusted is false
diff --git a/Tests/LibWeb/Text/input/synthetic-event-constructor-istrusted-check.html b/Tests/LibWeb/Text/input/synthetic-event-constructor-istrusted-check.html
new file mode 100644
index 00000000000..6af2c485cb4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/synthetic-event-constructor-istrusted-check.html
@@ -0,0 +1,6 @@
+
+
diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp
index 98614230812..42edf0008c1 100644
--- a/Userland/Libraries/LibWeb/DOM/Event.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Event.cpp
@@ -18,14 +18,18 @@ namespace Web::DOM {
JS_DEFINE_ALLOCATOR(Event);
+// https://dom.spec.whatwg.org/#concept-event-create
JS::NonnullGCPtr Event::create(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
{
- return realm.heap().allocate(realm, realm, event_name, event_init);
+ auto event = realm.heap().allocate(realm, realm, event_name, event_init);
+ // 4. Initialize event’s isTrusted attribute to true.
+ event->m_is_trusted = true;
+ return event;
}
WebIDL::ExceptionOr> Event::construct_impl(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
{
- return create(realm, event_name, event_init);
+ return realm.heap().allocate(realm, realm, event_name, event_init);
}
// https://dom.spec.whatwg.org/#inner-event-creation-steps