Skip to content

TypeError: element2.getAttribute is not a function #15336

Closed
@hyunbinseo

Description

@hyunbinseo

Note

If you face similar issue, please comment on #15337

Describe the bug

On an existing, working SvelteKit project without any errors, this suddenly happens in the browser:

Caution

Uncaught (in promise) TypeError: element2.getAttribute is not a function

/**
 * @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
  in +layout.svelte
  in root.svelte
    set_attribute attributes.js:154
    _layout +layout.svelte:48
    head svelte-head.js:59
    update_reaction runtime.js:427

    (omitted below)

This happens on both macOS and Windows.

This is not fixed with

  • disabling browser cache or using the incognito tab
  • trying another browser (e.g. Chrome instead of Firefox)
  • deleting node_modules/.vite and restarting dev server
  • removing node_modules and reinstalling dependencies
  • re-cloning the project and starting fresh

Reproduction

Cannot provide reproduction (yet)

System Info

System:
  OS: Windows 11 10.0.26100
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 9.05 GB / 31.51 GB
Binaries:
  Node: 22.14.0 - ~\AppData\Local\fnm_multishells\160156_1739934653049\node.EXE
  npm: 10.9.2 - ~\AppData\Local\fnm_multishells\160156_1739934653049\npm.CMD   
  pnpm: 10.3.0 - ~\AppData\Local\fnm_multishells\160156_1739934653049\pnpm.CMD 
Browsers:
  Edge: Chromium (131.0.2903.112)

Severity

blocking all usage of svelte

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