New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5: <img loading="lazy">
loads eagerly in Firefox (regression)
#11497
Comments
I think I vaguely remember this coming up before. I think it was related to the order that attributes are attached to the element - i.e., if |
Do you mean #7657? I'm not sure how much it's related as the order of attributes is "correct" in my code — maybe different story on the emitted side? |
Hello, The difference seems to come from the fact that Svelte 4 uses Exemple here :
This appears to be a Firefox's bug... |
Edit: nevermind, seems like the download is triggered when the Edit 2: poking around some more, it seems like the const template = document.createElement('template');
template.innerHTML = '<img height="200" width="200" loading="lazy" alt="" src="" />';
const img1 = template.content.firstChild;
console.log("img1 src:", img1.src); const img2 = document.createElement('img');
img2.height = 200;
img2.width = 200;
img2.loading = "lazy";
img2.alt = "";
console.log("img2 src:", img2.src); |
I wonder if this is another of those cases that fails when using |
Describe the bug
Setting
loading="lazy"
on an<img>
element in a Svelte 5 component does not affect a change when viewed in Firefox, and the image is still loaded eagerly. This appears to be a regression from Svelte 4, where the attribute correctly makes the images load lazily. Chromium-based browsers appear unaffected based on a very quick test.On my machine, Svelte 4:
Svelte 5:
This may or may not be connected to one of the reported Firefox bugs in this area:
Reproduction
Minimal reproduction:
Run in Svelte 4 REPL and Svelte 5 REPL with the Firefox devtools network tab open and compare the behavior.
Logs
No response
System Info
Browser information
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: