Skip to content

Commit cee58e9

Browse files
committed
fix: consider img with loading attribute not static
1 parent 4bcd01b commit cee58e9

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

.changeset/nice-chicken-wonder.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: consider img with loading attribute not static

packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ function is_static_element(node) {
150150
return false;
151151
}
152152

153+
if (node.name === 'img' && attribute.name === 'loading') {
154+
return false;
155+
}
156+
153157
if (node.name.includes('-')) {
154158
return false; // we're setting all attributes on custom elements through properties
155159
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
html: `<h1></h1><img src="..." loading="lazy" />`
5+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1></h1>
2+
<img src="..." loading="lazy">

0 commit comments

Comments
 (0)