question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`sveltekit:prefetch` seems to be invalid HTML

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
Rich-Harriscommented, Aug 24, 2022

As mentioned on the PR, I’m opposed to a transform step that changes sveltekit:prefetch to data-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 of data- 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?

5reactions
ghostdevvcommented, Jul 23, 2022

Could sveltekit:prefetch be internally search & replaced with data-sveltekit-prefetch so it’s not breaking and it keeps the good DX?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found