3 ms·
That's the styleguide that Flask and other pallets docs always had for many years already. People keep opening pull requests to change it and are always surpris
by the_mitsuhiko 10y ago
That's the styleguide that Flask and other pallets docs always had for many years already. People keep opening pull requests to change it and are always surprised when I point ou that it's not only not wrong but also by the spec.
If you consider how the parser for HTML5 actually works many of the closing tags you would encounter don't actually add any value unless you have some trailing text that should be attached to the parent node.
- tedmiston 10y agoDo you have a linter or some such automated style guide that you use to enforce this style?
- the_mitsuhiko 10y agoNot really but pretty sure that's the default serialization of html5lib.
- gsnedders 10y agoFor now. It's likely to change however, as it makes the tree less likely to round-trip. (html5lib essentially follows what the Writing HTML Documents section non-normatively states, but this is only actually true provided the document matches the schema. There are plenty of invalid cases where it causes it to not round-trip.) FWIW, there's also some trees which are impossible to serialise in HTML-without-parse-errors which I don't expect to ever round-trip, though all such trees also fail to match the schema. A trivial example of this is `<a><table><a>`, which ends up with an a element as a child of an a element (and is, far as I'm aware, the only way except for scripting to create such a tree).