ValidationError: Classes can only be applied to DOM elements, not components
See original GitHub issueIn my setup I use the rollup-plugin-svelte and for the client-side routing I tried the svero svelte router. Apparently, passing a class attribute to component should be possible, see kazzkiq/svero#13 and kazzkiq/svero@26b48a6
When I try to use it as in the example from kazzkiq/svero#45 I got following compile error:
rollup v1.27.0
bundles src/main.js → public/bundle.js...
[!] (plugin svelte) ValidationError: Classes can only be applied to DOM elements, not components
src/components/Navbar.svelte
38: <ul class="navbar-nav mx-auto">
39: <li class="nav-item mx-2">
40: <Link href={MAIN_PATH} class:active={path.includes(MAIN_PATH)}>
^
41: Feedback
42: </Link>
ValidationError: Classes can only be applied to DOM elements, not components
I do not think this is actually related to svero but probably to the rollup-plugin-svelte
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Adding classes to components in SvelteKit - Stack Overflow
However, you cannot use the Svelte class:name directive on IconButton as that type of directive is indeed restricted to DOM elements.
Read more >Workaround for "Transitions can only be applied to DOM ...
I have a small carousel of pullquotes. When a pullquote changes, I want to cross-fade from the current quote to the new quote....
Read more >constructor - JavaScript - MDN Web Docs - Mozilla
The ValidationError class doesn't need an explicit constructor, because it doesn't need to do any custom initialization. The default constructor ...
Read more >Element: <oj-input-text> - Oracle
See validate method on the sub-classes for details. Note: JET validation is designed to catch user input errors, and not invalid data passed ......
Read more >Validation · Bootstrap v5.0
Bootstrap scopes the :invalid and :valid styles to parent .was-validated class, usually applied to the <form> . Otherwise, any required field without a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, yes, this line allows
class
to be provided as a prop. You can’t use it in directive form though, so it will need to be:Thanks for clarification 👍 closing now