html-parser-book
html-parser-book copied to clipboard
Who is intentionally moving omissible tags?
https://htmlparser.info/introduction/
The rules for when they can be omitted are slightly convoluted, but they assume that the DOM is not allowed to change by omitting a tag. It is however conforming to intentionally move a tag such that omitting it no longer changes the DOM.
I'm having trouble understanding what this means. I think it's saying that it's OK for an author to place end tags such that removing them have no effect, like this:
<p>foo
</p><p>bar</p>
However, that seems like a strange thing to point out as being valid, since this is aligned with the rule of thumb of omission not changing the DOM. So I think I'm misunderstanding this bit, what is being conveyed.
What I'm trying to say is that if you have this
<p>foo</p>
<p>bar</p>
then it's not allowed to omit the </p>
but if you have
<p>foo
</p><p>bar</p>
then it is allowed.
Maybe I should have these examples, and not talk about moving tags.
Talking about the bits of markup that are valid and not what changes to markup are confirming would probably help. Removing the tag in the two cases results in the same markup, which is conforming.
Is this really an FYI to authors that omitting tags can change where whitespace ends up, rather than a matter of conformance?
In practice it's an FYI. If you read the spec strictly, it's about conformance, but you need to wear the ultra-pedantic glasses to see it.