Some HTML errors
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:

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
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
dlultableetc. 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
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.