`sveltekit:prefetch` seems to be invalid HTML
See original GitHub issueDescribe the problem
Hey, I just validated my SvelteKit website with https://validator.w3.org/nu/ and it heavily complained about sveltekit:prefetch
not being valid HTML.
Is this a problem? Maybe if some service wanted to rank the quality of some website, they would use an HTML validator and adjust the ranking accordingly?
Describe the proposed solution
To avoid that, maybe the Svelte compiler could automatically turn such things into a valid HTML attribute like data-sveltekit="prefetch"
from where the router can pick it up?
In my imagination this should be fairly easy to implement and would result in valid HTML.
Alternatives considered
No response
Importance
nice to have
Additional Information
Thank you very much for building Svelte!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Parsley remote This value seems to be invalid - Stack Overflow
the first attempt is the one that gave me the best result however no matter what i did it always says: This value...
Read more >invalid - CSS: Cascading Style Sheets - MDN Web Docs
The :invalid CSS pseudo-class represents any , , or other element whose contents fail to validate.
Read more >CSS :invalid Selector - W3Schools
Definition and Usage. The :invalid selector selects form elements with a value that does not validate according to the element's settings.
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
As mentioned on the PR, I’m opposed to a transform step that changes
sveltekit:prefetch
todata-sveltekit-prefetch
under the hood (https://github.com/sveltejs/kit/pull/6170#issuecomment-1223322743).Which means that if we were to make this change, it would be a breaking change — we would no longer be able to use
sveltekit:prefetch
etc and would have to use the arguably inferior ergonomics ofdata-
prefixes.If we make such a change, it should be for a good reason, not a speculative one like ‘search engines might downrank you’ or ‘a11y tools might complain’. I’m unaware of any such impacts (and I’d expect more people to have found their way to this thread if there were), so my inclination would be to leave things as they are, but I’d be interested to hear from anyone if there’s a compelling reason to switch?
Could
sveltekit:prefetch
be internally search & replaced withdata-sveltekit-prefetch
so it’s not breaking and it keeps the good DX?