mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 10:36:24 +00:00
LibWeb: Implement HTMLImageElement.fetchPriority
This commit is contained in:
parent
2b5c3886d9
commit
5ae9b49099
|
@ -0,0 +1,5 @@
|
|||
fetchPriority = auto
|
||||
|
||||
fetchPriority = high
|
||||
|
||||
fetchPriority = auto
|
18
Tests/LibWeb/Text/input/HTML/img-element-fetch-priority.html
Normal file
18
Tests/LibWeb/Text/input/HTML/img-element-fetch-priority.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<img id="testImg">
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const img = document.getElementById('testImg');
|
||||
|
||||
println(`fetchPriority = ${img.fetchPriority}`);
|
||||
println('');
|
||||
|
||||
img.fetchPriority = 'high';
|
||||
|
||||
println(`fetchPriority = ${img.fetchPriority}`);
|
||||
println('');
|
||||
|
||||
img.fetchPriority = 'invalid-value';
|
||||
println(`fetchPriority = ${img.fetchPriority}`);
|
||||
});
|
||||
</script>
|
|
@ -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()) {
|
||||
|
|
|
@ -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<undefined> decode();
|
||||
|
||||
|
|
Loading…
Reference in a new issue