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

Some HTML errors #399

Open
Rezyan opened this issue Nov 23, 2022 · 2 comments
Open

Some HTML errors #399

Rezyan opened this issue Nov 23, 2022 · 2 comments

Comments

@Rezyan
Copy link
Contributor

Rezyan commented Nov 23, 2022

Hi,

While working on a project and validating the HTML code of the page with the W3C Markup Validation Service, I noticed that the Kint library had some HTML errors:

1

Possible solution for the <style> tag error

The <style> tag must be contained in the <head> tag. So we could add it dynamically through JavaScript.

Context

  • PHP: v8.1.2
  • Kint: v5.0.1 (latest)
  • Browser: Google Chrome v107.0.5304.107
  • OS: Windows 10
@jnvsor
Copy link
Member

jnvsor commented Nov 23, 2022

For the first one there: We can't help where kint is dumped. If it's dumped inside a div then that's where it'll be. If you want to hook up the prerender to happen in your header you can but you'd need to write that yourself since every application will do it differently.

So we could add it dynamically through JavaScript.

That's a bad idea for a few reasons:

  • I don't want the entire CSS to be contained inside the JS. Smells bad

  • It would fail to render if JS is disabled.

    Now you can't use kint very well without JS, but it's better than it screwing up your entire layout with a massive dump of unstyled dl ul table etc. elements.

    Having styles without JS also lets you see dumps in the network preview tab when debugging ajax requests.

  • The nastiest validation issues can screw up the DOM before the javascript even runs, and then you can't fix it afterwards. (Example: Dumping tabular data inside a table but outside a cell, the contents will spill out and the DOM will restructure in a way that you can't recover it)

While a strict reading does say the other two points are still valid, neither firefox nor chrome show any notices in console nor render it incorrectly, and since you probably shouldn't have kint dumps facing customers anyway a few validation errors isn't a big deal.

Since it's technically incorrect I'll put the nav and dd things on the todo list, but you're looking at a large restructuring of the HTML/CSS/JS with less semantic elements so it's definitely off the table until another major version bump. (And there are other issues with eg. table inside pre and so on if we go down that rabbit hole)

PS: whatwg recommends the "experimental" validator instead, the old one isn't up to date

@Rezyan
Copy link
Contributor Author

Rezyan commented Nov 23, 2022

As you want for the errors, it is in no way annoying, I just wanted towarn.

PS: whatwg recommends the "experimental" validator instead, the old one isn't up to date

When using the old form, you're automatically redirect to the new one. So, the 3 errors are also showed on the new one.

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

No branches or pull requests

2 participants