LibWeb: Test fetchPriority attribute on all elements

This commit is contained in:
Jamie Mansfield 2024-06-07 17:54:06 +01:00 committed by Andreas Kling
parent 2fed064791
commit 1dda129fe1
Notes: sideshowbarker 2024-07-16 22:54:10 +09:00
4 changed files with 43 additions and 23 deletions

View file

@ -0,0 +1,21 @@
link fetchPriority initial value: auto
link fetchPriority value after setting to "invalid": auto
link fetchPriority value after setting to "high": high
link fetchPriority value after setting to null: auto
link fetchPriority value after setting to "HIGH": high
link fetchPriority value after setting to "": auto
link fetchPriority value after calling removeAttribute: auto
img fetchPriority initial value: auto
img fetchPriority value after setting to "invalid": auto
img fetchPriority value after setting to "high": high
img fetchPriority value after setting to null: auto
img fetchPriority value after setting to "HIGH": high
img fetchPriority value after setting to "": auto
img fetchPriority value after calling removeAttribute: auto
script fetchPriority initial value: auto
script fetchPriority value after setting to "invalid": auto
script fetchPriority value after setting to "high": high
script fetchPriority value after setting to null: auto
script fetchPriority value after setting to "HIGH": high
script fetchPriority value after setting to "": auto
script fetchPriority value after calling removeAttribute: auto

View file

@ -1,5 +0,0 @@
fetchPriority = auto
fetchPriority = high
fetchPriority = auto

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
for (const elementName of ["link", "img", "script"]) {
const element = document.createElement(elementName);
println(`${elementName} fetchPriority initial value: ${element.fetchPriority}`);
element.fetchPriority = "invalid";
println(`${elementName} fetchPriority value after setting to "invalid": ${element.fetchPriority}`);
element.fetchPriority = "high";
println(`${elementName} fetchPriority value after setting to "high": ${element.fetchPriority}`);
element.fetchPriority = null;
println(`${elementName} fetchPriority value after setting to null: ${element.fetchPriority}`);
element.fetchPriority = "HIGH";
println(`${elementName} fetchPriority value after setting to "HIGH": ${element.fetchPriority}`);
element.fetchPriority = "";
println(`${elementName} fetchPriority value after setting to "": ${element.fetchPriority}`);
element.removeAttribute("fetchPriority");
println(`${elementName} fetchPriority value after calling removeAttribute: ${element.fetchPriority}`);
}
});
</script>

View file

@ -1,18 +0,0 @@
<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>