LibWeb: Implement HTMLImageElement.currentSrc

Removes some console noise from lner.co.uk :)
This commit is contained in:
Jamie Mansfield 2024-05-24 00:08:03 +01:00 committed by Andreas Kling
commit 3095daa7c8
Notes: sideshowbarker 2024-07-17 18:08:55 +09:00
3 changed files with 11 additions and 1 deletions

View file

@ -269,6 +269,13 @@ bool HTMLImageElement::complete() const
return false; 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<ARIA::Role> HTMLImageElement::default_role() const Optional<ARIA::Role> HTMLImageElement::default_role() const
{ {
// https://www.w3.org/TR/html-aria/#el-img // https://www.w3.org/TR/html-aria/#el-img

View file

@ -57,6 +57,9 @@ public:
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
bool complete() const; bool complete() const;
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc
String current_src() const;
virtual Optional<ARIA::Role> default_role() const override; virtual Optional<ARIA::Role> default_role() const override;
// https://html.spec.whatwg.org/multipage/images.html#img-environment-changes // https://html.spec.whatwg.org/multipage/images.html#img-environment-changes

View file

@ -19,7 +19,7 @@ interface HTMLImageElement : HTMLElement {
readonly attribute unsigned long naturalWidth; readonly attribute unsigned long naturalWidth;
readonly attribute unsigned long naturalHeight; readonly attribute unsigned long naturalHeight;
readonly attribute boolean complete; readonly attribute boolean complete;
[FIXME] readonly attribute USVString currentSrc; readonly attribute USVString currentSrc;
[FIXME, CEReactions] attribute DOMString referrerPolicy; [FIXME, CEReactions] attribute DOMString referrerPolicy;
[FIXME, CEReactions] attribute DOMString decoding; [FIXME, CEReactions] attribute DOMString decoding;
[CEReactions, Enumerated=LazyLoadingAttribute, Reflect] attribute DOMString loading; [CEReactions, Enumerated=LazyLoadingAttribute, Reflect] attribute DOMString loading;