Re: Optional tags

My take on it is that just because you can omit tags, that doesn't mean you
should.  If omitting a tag leaves the meaning ambiguous, then it is the
author's fault for leaving that fragment ambiguous.

>From a parsing point of view, I think it's safe to say that most parsers
will insert the omitted tag at the last possible moment at which it is
realized to be missing.

<ul>
<li><p>This<p>That
<li><p>Another
</ul>

Therefore translates to:

<ul>
<li><p>This</p><p>That
</p></li><li><p>Another
</p></li></ul>

Which is ugly code, in my opinion.

The ambiguity in rendering seems to be due to white-space text nodes
existing between list item nodes.

<ul>
<li><p>This example</p></li>
<li><p>Has the oddity of white space between these two list items.</p></li>
</ul>

Even though that is more elegant code, imo, you would need to cram them
onto the same line in order to prevent that white-space from creeping in,
which really only matters in practice if you've turned the ul tag into an
inline display model.  Ironically, the "uglier" version of the code above
doesn't suffer from this problem.

Jeff


On Sun, Jan 26, 2014 at 5:51 PM, Jens O. Meiert <jens@meiert.com> wrote:

> On Fri, Jan 24, 2014 at 5:37 AM, Jukka K. Korpela
> > The difference matters, for example, if you work with the element
> content in
> > client-side JavaScript or if if you add content in CSS with p:after {
> > content: ... }.
>
> On Sun, Jan 26, 2014 at 5:16 PM, Mathias Nater <mnater@mac.com> wrote:
> > This is the cause for an issue in Hyphenator.js:
> > https://code.google.com/p/hyphenator/issues/detail?id=194
>
> Interesting. I was aware of possible issues (old stuff related to list
> markup in IE, for example) but they seemed too esoteric, and thus the
> idea that it may not be practically relevant.
>
> Cheers,
>  Jens.
>
> --
> Jens O. Meiert
> http://meiert.com/en/
>
>

Received on Monday, 27 January 2014 05:58:20 UTC