diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index a15ae9d3e1..7ae044cc51 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -269,6 +269,13 @@ bool HTMLImageElement::complete() const
return false;
}
+// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc
+String HTMLImageElement::current_src() const
+{
+ // The currentSrc IDL attribute must return the img element's current request's current URL.
+ return MUST(m_current_request->current_url().to_string());
+}
+
Optional HTMLImageElement::default_role() const
{
// https://www.w3.org/TR/html-aria/#el-img
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
index 6f22535766..5ef975c794 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
@@ -57,6 +57,9 @@ public:
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
bool complete() const;
+ // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc
+ String current_src() const;
+
virtual Optional default_role() const override;
// https://html.spec.whatwg.org/multipage/images.html#img-environment-changes
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
index 762a93a78e..6b80732bc9 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
@@ -19,7 +19,7 @@ interface HTMLImageElement : HTMLElement {
readonly attribute unsigned long naturalWidth;
readonly attribute unsigned long naturalHeight;
readonly attribute boolean complete;
- [FIXME] readonly attribute USVString currentSrc;
+ readonly attribute USVString currentSrc;
[FIXME, CEReactions] attribute DOMString referrerPolicy;
[FIXME, CEReactions] attribute DOMString decoding;
[CEReactions, Enumerated=LazyLoadingAttribute, Reflect] attribute DOMString loading;