-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hasAttribute is not a function #15241
Comments
This works: <!-- routes/+page.svelte -->
<input checked /> This fails: <!-- routes/+page.svelte -->
text <input checked /> and so does this: <!-- routes/+page.svelte -->
<div></div>
<input checked /> This works again: <!-- routes/+page.svelte -->
<div></div>
<div>
<input checked />
</div> and so does this: <!-- routes/+page.svelte -->
<div></div>
<input /> Issue occurs in both dev and preview. With JS disabled in the browser, the page loads fine though. Also no issue when running the same code in Svelte REPL or when using svelte template with Diff of compiler outputs in the two cases--- just_input.js 2025-02-08 14:30:15.887715835 +0530
+++ input_with_siblings.js 2025-02-08 14:29:58.129556652 +0530
@@ -1,21 +1,23 @@
-import { createHotContext as __vite__createHotContext } from "/@vite/client";import.meta.hot = __vite__createHotContext("/src/routes/+layout.svelte");import "/node_modules/.vite/deps/svelte_internal_disclose-version.js?v=44ac6c46";
+import { createHotContext as __vite__createHotContext } from "/@vite/client";
+import "/node_modules/.vite/deps/svelte_internal_disclose-version.js?v=44ac6c46";
import "/node_modules/.vite/deps/svelte_internal_flags_legacy.js?v=44ac6c46";
-
+import.meta.hot = __vite__createHotContext("/src/routes/+layout.svelte");
$.mark_module_start();
_layout[$.FILENAME] = 'src/routes/+layout.svelte';
import * as $ from "/node_modules/.vite/deps/svelte_internal_client.js?v=44ac6c46";
-var root = $.add_locations($.template(`<input checked>`), _layout[$.FILENAME], [[4, 0]]);
+var root = $.add_locations($.template(`<input checked> .`, 1), _layout[$.FILENAME], [[4, 0]]);
function _layout($$anchor, $$props) {
$.check_target(new.target);
$.push($$props, false, _layout);
- var input = root();
+ var fragment = root();
- $.remove_input_defaults(input);
- $.append($$anchor, input);
+ $.remove_input_defaults();
+ $.next();
+ $.append($$anchor, fragment);
return $.pop({ ...$.legacy_api() });
} Here we can see that |
Describe the bug
some specific code specifically in sveltekit specifically when built causes a runtime error, likely due to there being no
value
assignedthis may seem like a silly case but it makes sense when only demonstrating UI components
if this behavior shouldn't be allowed, then svelte should error at compile time
Reproduction
https://github.com/KTibow/hasattributebug
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: