Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .changeset/shy-needles-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@lynx-js/web-elements-template": patch
"@lynx-js/web-elements": patch
---

perf: add loading="lazy" for image element

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading
4 changes: 3 additions & 1 deletion packages/web-platform/web-elements-template/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
'detected <script, this is a potential XSS attack, please check your src',
);
}
return `<img part="img" alt="" id="img" ${src ? `src="${src}"` : ''}/> `;
return `<img part="img" alt="" loading="lazy" id="img" ${
src ? `src="${src}"` : ''

Check warning

Code scanning / CodeQL

Unsafe HTML constructed from library input Medium

This HTML construction which depends on
library input
might later allow
cross-site scripting
.
}/> `;
};

export const templateFilterImage = templateXImage;
Expand Down
Loading