Comment by ZiiS
18 hours ago
You are also not required to indent code (in most languages); please do if you want me to read it though.
18 hours ago
You are also not required to indent code (in most languages); please do if you want me to read it though.
You can also indent with spaces and tabs at the same time, who's judging?
Not in python, which is how I always discover someone is using tabs ..
As long as you stay consistent with the whitespace count line by line, you can!
You monster.
Golang would like a word...
1 reply →
Closing optional HTML tags just adds more ambiguity. How many HTMLParagraphElements here, what do you think?
2. And there’s no ambiguity there, just invalid HTML because paragraphs aren’t nestable.
It may look nested but the first p is actually closed when the second p starts, according to https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
3 replies →
Browser will parse that as three HTMLParagraphElements. You may think that's invalid HTML, but browser will parse it and won't indicate any kind of error.
11 replies →
Excellent catch
Why would you nest paragraph tags?
They are not nested, according to HTML5 parsing rules. You get 3 (yes, three) sibling paragraphs, including an empty one.
There being nesting is just implied by the closing tags and indentation. But it is not actually there. I think this is the point of the example: Adding the closing tags just confuses the reader, by implying nesting that is not actually there, and even introduces a third empty paragraph. It might be better left out entirely.
That is invalid syntax. Only phrasing content is allowed the p element (https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Con...)
The second <p> is not inside of the first. The first <p> closes when the second <p> is encountered.
The syntax is invalid, but that's because the final </p> has no opening <p> that it can close.
This is invalid html, p tag can be nested in a p tag.
Even though it arguably should be, according to HTML5 parsing rules, this is not invalid. It is just interpreted differently from what most people would probably expect.
I think this is the point of the example, afaiui: The closing tags don’t clarify anything, quite the contrary, actually. They serve only to confuse the reader.
HTML is more content than programming logic, so it shouldn't be indented.