kint-php / kint

Kint - Advanced PHP dumper
https://kint-php.github.io/kint/
MIT License
2.78k stars 292 forks source link

Some HTML errors #399

Open Rezyan opened 1 year ago

Rezyan commented 1 year ago

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

jnvsor commented 1 year ago

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:

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 commented 1 year ago

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.