Open
Description
Describe the bug
This Svelte code randomly causes the following issue:
Caution
Uncaught (in promise) TypeError: element2.getAttribute is not a function
<script>
import logo from '$lib/logo.svg?no-inline';
</script>
<svelte:head>
<link rel="icon" href={logo} />
</svelte:head>
<slot></slot>
Uncaught (in promise) TypeError: element2.getAttribute is not a function
in +layout.svelte
in root.svelte
set_attribute attributes.js:154
_layout +layout.svelte:48
/**
* @param {Element} element
* @param {string} attribute
* @param {string | null} value
* @param {boolean} [skip_warning]
*/
export function set_attribute(element, attribute, value, skip_warning) {
// @ts-expect-error
var attributes = (element.__attributes ??= {});
if (hydrating) {
attributes[attribute] = element.getAttribute(attribute); // here
function _layout($$anchor, $$props) {
$.check_target(new.target);
$.push($$props, true, _layout);
var fragment_1 = $.comment();
$.head(($$anchor) => {
var fragment = root_1();
var link = $.first_child(fragment);
$.set_attribute(link, 'href', logo); // here
Reproduction
Failed to create a reproduction.
It suddenly happens without changing a single-line of code in an existing, working, error free code-base.
Attempt for debugging documented in this issue:
Logs
System Info
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
Memory: 13.81 GB / 31.51 GB
Binaries:
Node: 23.7.0 - ~\AppData\Local\fnm_multishells\6624_1739936373546\node.EXE
npm: 10.9.2 - ~\AppData\Local\fnm_multishells\6624_1739936373546\npm.CMD
pnpm: 10.4.0 - ~\AppData\Local\fnm_multishells\6624_1739936373546\pnpm.CMD
Browsers:
Edge: Chromium (131.0.2903.112)
Severity
annoyance