Skip to content

img with loading attribute will lead to "read properties of undefined (reading 'loading')" #14235

@Mingx94

Description

@Mingx94

Describe the bug

When navigate to a page that has img element with loading attribute, the page crashed and showing "read properties of undefined (reading 'loading')" in console.

Reproduction

https://svelte.dev/playground/fd9fd756b9c942f18f5c9364a8c46454?version=5.1.13

Logs

Uncaught TypeError: Cannot read properties of undefined (reading 'loading')

	in +layout.svelte
	in root.svelte

    at Module.handle_lazy_img (chunk-5S7XBGTN.js?v=925f45c9:1586:30)
    at _page (+page.svelte:34:23)
    at chunk-5S7XBGTN.js?v=925f45c9:222:58
    at update_reaction (chunk-GFV2NITQ.js?v=925f45c9:889:23)
    at update_effect (chunk-GFV2NITQ.js?v=925f45c9:980:21)
    at create_effect (chunk-GFV2NITQ.js?v=925f45c9:1992:7)
    at branch (chunk-GFV2NITQ.js?v=925f45c9:2124:10)
    at chunk-5S7XBGTN.js?v=925f45c9:216:17
    at update_reaction (chunk-GFV2NITQ.js?v=925f45c9:889:23)
    at update_effect (:5173/node_modules/.vite/deps/chunk-GFV2NITQ.js?v=925f45c9:980:21)TypeError: Cannot read properties of undefined (reading 'loading')
    at Module.handle_lazy_img (chunk-5S7XBGTN.js?v=925f45c9:1586:30)
    at _page (+page.svelte:34:23)
    at chunk-5S7XBGTN.js?v=925f45c9:222:58
    at update_reaction (chunk-GFV2NITQ.js?v=925f45c9:889:23)
    at update_effect (chunk-GFV2NITQ.js?v=925f45c9:980:21)
    at create_effect (chunk-GFV2NITQ.js?v=925f45c9:1992:7)
    at branch (chunk-GFV2NITQ.js?v=925f45c9:2124:10)
    at chunk-5S7XBGTN.js?v=925f45c9:216:17
    at update_reaction (chunk-GFV2NITQ.js?v=925f45c9:889:23)
    at update_effect (chunk-GFV2NITQ.js?v=925f45c9:980:21)

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400
    Memory: 13.51 GB / 31.85 GB
  Binaries:
    Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.12.3 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    svelte: ^5.1.9 => 5.1.9

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions