Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nice-chicken-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: consider img with loading attribute not static
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ function is_static_element(node) {
return false;
}

// an img with loading lazy is not static but needs the `img` to be
// generated to be passed to `handle_lazy_img`
if (node.name === 'img' && attribute.name === 'loading') {
return false;
}

if (node.name.includes('-')) {
return false; // we're setting all attributes on custom elements through properties
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { test } from '../../test';

export default test({
html: `<h1></h1><img src="..." loading="lazy" />`
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1></h1>
<img src="..." loading="lazy">
Loading