diff --git a/Tests/LibWeb/Text/expected/HTML/img-element-fetch-priority.txt b/Tests/LibWeb/Text/expected/HTML/img-element-fetch-priority.txt new file mode 100644 index 0000000000..c3a1c4708b --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/img-element-fetch-priority.txt @@ -0,0 +1,5 @@ + fetchPriority = auto + +fetchPriority = high + +fetchPriority = auto diff --git a/Tests/LibWeb/Text/input/HTML/img-element-fetch-priority.html b/Tests/LibWeb/Text/input/HTML/img-element-fetch-priority.html new file mode 100644 index 0000000000..ae41552d58 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/img-element-fetch-priority.html @@ -0,0 +1,18 @@ + + + diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 7ae044cc51..88375b0e01 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -563,7 +563,8 @@ after_step_7: // 21. Set request's referrer policy to the current state of the element's referrerpolicy attribute. request->set_referrer_policy(ReferrerPolicy::from_string(get_attribute_value(HTML::AttributeNames::referrerpolicy)).value_or(ReferrerPolicy::ReferrerPolicy::EmptyString)); - // FIXME: 22. Set request's priority to the current state of the element's fetchpriority attribute. + // 22. Set request's priority to the current state of the element's fetchpriority attribute. + request->set_priority(Fetch::Infrastructure::request_priority_from_string(get_attribute_value(HTML::AttributeNames::fetchpriority)).value_or(Fetch::Infrastructure::Request::Priority::Auto)); // 24. If the will lazy load element steps given the img return true, then: if (will_lazy_load_element()) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl index 6b80732bc9..cab5f7845d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl @@ -23,7 +23,7 @@ interface HTMLImageElement : HTMLElement { [FIXME, CEReactions] attribute DOMString referrerPolicy; [FIXME, CEReactions] attribute DOMString decoding; [CEReactions, Enumerated=LazyLoadingAttribute, Reflect] attribute DOMString loading; - [FIXME, CEReactions] attribute DOMString fetchPriority; + [CEReactions, Enumerated=FetchPriorityAttribute, Reflect=fetchpriority] attribute DOMString fetchPriority; [FIXME] Promise decode();