XHTML validity


I tried XHTML validator and it looks like most of our pages are far from valid, we have some stray end elements, our menu is in bad shape in particular. Any volunteers to have a look?

Can we do something to avoid introducing invalid HTML, like some integration view tests?

Can you try it with a HTML5 validator instead of XHTML? XHTML is a standard that went nowhere since the web chose HTML5. Many things that are correct in HTML5 (<br>) aren’t in XHTML (<br />).

Foreman has HTML(5) as doctype defined.

Yeah, this way a typo on my side, it’s nothing like missing <br> tags, we have unclosed divs and similar bugs. That’s not valid in any HTML markup language.

I am just curious if folks don’t know some validation test framework.

Since we have HTML not XHTML, there should be no issue with un-closed tags. (Personally i’m all for XML validity :))

However, yes there are a number of validation issues that really should not happen, like , between attributes. These should at some point be fixed, but since browser engines are nice enough to ignore these issues and make it work anyways, it shouldn’t be a priority or be part of our test suite, I think.

There are cases where browsers start acting weird with invalid HTML code, most of the time rendering issues including CSS bugs. In these case the first thing should be validating the pages source code static and dynamic (react components, etc.).

There is Tidy (http://www.html-tidy.org/), which does offer validation via command line, but most of the times copy&pasting to the W3C validator is quicker.

Well, unclosed div is still an issue in HTML, because you can easily run into issues in the future - simple change can break things hard. Anyway, I agree with you it would be “nice” to have valid code. I made an attempt to integrate “tidy” like ruby checker into integration tests but it did not work well.