3 ms·
Invalid XHTML: Throw an error, yell at the user, who should just be the author since broken XHTML shouldn't have been allowed make it to the end user. "Invalid
by Macha 5y ago
Invalid XHTML: Throw an error, yell at the user, who should just be the author since broken XHTML shouldn't have been allowed make it to the end user.
"Invalid" HTML5: Please refer to section X.Y for the heuristics to apply in this scenario.
"Invalid" HTML4: Uhh, just do whatever? But probably you need to do whatever the other browsers do.
Implementing the other behaviours is more work than not implementing them, and may be more difficult if your internal data structures don't match those of the browser for which it was originally introduced as expedient or even emergent behaviour.
- spiralx 5y agoHTML5 is expressible as valid SGML with some exceptions such as ARIA and data-* attributes. And SGML, which is a super-set of XML, has rules for both optional elements - e.g. HEAD - and for elements with optional closing tags - e.g. P. http://sgmljs.net/docs/html5.html http://sgmljs.net/docs/html5.html
- Macha 5y agoPart of the XML motivation was for something simpler than SGML. SGML has no opinions on rendering, since it's just a generic markup language. Nor does it have opinions on "what do with a hr that's a direct descendant of the table despite not being permitted", to pick the first example from the spec (it should be treated as a preceding sibling).