Skip to content
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

Svelte 5: Bogus comments caused by <![><!]> #10976

Closed
Jumaron opened this issue Mar 28, 2024 · 3 comments · Fixed by #10980
Closed

Svelte 5: Bogus comments caused by <![><!]> #10976

Jumaron opened this issue Mar 28, 2024 · 3 comments · Fixed by #10980

Comments

@Jumaron
Copy link

Jumaron commented Mar 28, 2024

Describe the bug

Today when trying to validate my Website for any HTML errors i used the w3c validator to check for any errors.
To my suprise it showed nearly 1000 errors, 99% of them with the same error:
Screenshot 2024-03-29 003251

The html of the page looks like this:
Screenshot 2024-03-29 003441

I wonder what could be done since this is both the cause localy on dev and also when deployed.

Reproduction

I have 0 idea when it happens or why.
I guess it happens if you use SSR and a Svelte Element that needs to be client Side fetched or Mounted?
Would be glad if this is not a known issue to help reproduce!!

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400F
    Memory: 2.70 GB / 15.85 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.2.5 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Edge: Chromium (122.0.2365.92)
    Internet Explorer: 11.0.22621.1

Severity

annoyance

@harrisi
Copy link

harrisi commented Mar 29, 2024

The bogus comment warnings aren't from <!--[-->, it's because what's actually injected is <![> and <!]> (which you can see from the warnings as well). I'm a little surprised these non-standard comments are used. I know it's less noise, but it's not standard. It doesn't seem worth it to save a few bytes and rely on browsers to not be too upset about this.

@Jumaron
Copy link
Author

Jumaron commented Mar 29, 2024

Wait yeah your right i'am just blind.

@Jumaron Jumaron changed the title Svelte 5: Bogus comments caused by <!--[--> Svelte 5: Bogus comments caused by <!]><!]> Mar 29, 2024
@Jumaron Jumaron changed the title Svelte 5: Bogus comments caused by <!]><!]> Svelte 5: Bogus comments caused by <![><!]> Mar 29, 2024
@Rich-Harris
Copy link
Member

The W3C validator is needlessly persnickety — short comments are understood everywhere that matters. That said, the benefit is fairly slight, and in the past we've decided in favour of being compliant, so I'd be open to changing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants