4 ms·
Not all of HTML can be represented with s-expressions. The following is perfectly valid. <b>Hello <i>World!</b> Greetings</i> Earthlings!
by btilly 2y ago
Not all of HTML can be represented with s-expressions. The following is perfectly valid.
<b>Hello <i>World!</b> Greetings</i> Earthlings!
- MathMonkeyMan 2y agoI never noticed that, though "doesn't require a closing tag" and "requires that there is no closing tag" ought to have been hints for me.
- LegionMammal978 2y agoAnd yet it's semantically identical to <b>Hello <i>World!</></b><i> Greetings</i> Earthlings! You can see this by looking at the innerHTML, which is really just a serialized form of the DOM tree.
- ptx 2y agoIs it actually valid? W3C's HTML validator complains about invalid nesting. It might work because the HTML5 parsing algorithm produces well-defined results for broken HTML, but I'm not sure that's the same as "perfectly valid" – the spec calls such markup "misnested" and "erroneous" [0]. [0] https://html.spec.whatwg.org/#an-introduction-to-error-handling-and-strange-cases-in-the-parser https://html.spec.whatwg.org/#an-introduction-to-error-handl...
- btilly 2y agoIt certainly was valid according to the original specs. I first saw it as an example over 20 years ago in a debate about whether XHTML should replace HTML 4.0.